gulp

Reduce Size of Large, React based Single Page Application's Browserify Bundle File

我只是一个虾纸丫 提交于 2019-12-24 00:28:56
问题 I am building a reactjs application using gulp and Browserify. I have used material-ui components in my application. There are 8 pages in my application using different components. The build.js created by Browserify is 4mb in size. I want to reduce its size. I have searched and learned a little about the lazy loading design pattern. But I am confused how it should be used to make the size smaller of my application? I am also using react router in my application so there are 8 routes defined.

HTML as Webpack entry point

无人久伴 提交于 2019-12-24 00:24:39
问题 First of all, I'm completely new to web development so if my approach is totally wrong, just say so. I want to automate build of sass and ts files, so I read about Gulp/Webpack , and seems like webpack is the way to go. I am building a simple single page website and for now I only have a small javascript that's needed, so it makes sense in my mind that the entry point for webpack should be the html file itself. However, all the docs and tutorials only talk about starting from a .js . Is there

Gulp consecutive tasks as stream

让人想犯罪 __ 提交于 2019-12-23 20:30:53
问题 Basically, I have tasks split in two. The first is for development. There’s no magic, just basic stuff to make it work. It’s fast and great. The latter is for production. It’s slow, and I only want to run it periodically for testing, debugging, optimisation and production. Hence they are two separate tasks. The latter, the task for production, does rely on the former task, however, I’d like to continue the stream, as if the latter task is an addition to the former. gulp.task('styles',

Target only the contents of a folder in gulp

岁酱吖の 提交于 2019-12-23 19:15:43
问题 I'm using Gulp to compile a project. I'm also using gulp-zip to zip a bunch of files. I want to zip up all the files in the "dist" folder, so I'm using this: var thesrc: ['dist/**/*']; gulp.task('createMainZip', ['createPluginZip'], function () { return gulp.src(thesrc) .pipe(zip('main_files.zip')) .pipe(gulp.dest('compiled')); }); This compiles the files to a zip in the following way: dist file.css another.js folder file.js However, I want it like this: file.css another.js folder file.js

Build React components with Gulp, Browserify and Babel

跟風遠走 提交于 2019-12-23 18:57:33
问题 I've created a React component and I want to distribute a built-in version (built with gulp) of this component, so in gulpfile.js I have: var gulp = require('gulp'); var browserify = require('browserify'); var babelify = require('babelify'); var source = require('vinyl-source-stream'); gulp.task('build-js', function() { return browserify('./src/Foo.js') .transform(babelify) .bundle() .pipe(source('bundle.js')) .pipe(gulp.dest('./dist')); }); gulp.task('build', ['build-js']); In .babelrc : {

How to invoke executing a PowerShell script from gulp?

白昼怎懂夜的黑 提交于 2019-12-23 18:05:39
问题 I am using gulp to build and deploy our application. var msbuild = require('gulp-msbuild'); gulp.task('build', ['clean'], function () { return gulp.src('../../*.sln') .pipe(msbuild({ toolsVersion: 14.0, targets: ['Rebuild'], errorOnFail: true, properties: { DeployOnBuild: true, DeployTarget: 'Package', PublishProfile: 'Development' }, maxBuffer: 2048 * 1024, stderr: true, stdout: true, fileLoggerParameters: 'LogFile=Build.log;Append;Verbosity=detailed', })); }); However after build I have to

Gulp Filter with SourceMaps

时光怂恿深爱的人放手 提交于 2019-12-23 17:53:58
问题 I had a similar question here that has merged into a bit more research on my part and a new way this could work. Basically I'm trying to have all of my .js and .coffee files within one gulp.src() object and based on the extension, do relevant tasks. What started off with gulp-if has turned into me using gulp-filter which I prefer honestly. The catch I'm running into right now is getting this all to work with gulp-sourcemaps. The current task seems to override the other -- but I'd ultimately

Tired of copying node_modules to wwwroot folder

不问归期 提交于 2019-12-23 17:41:36
问题 I have an ASP.NET 5 project with a plenty of Node.js modules. They are installed under the node_modules folder. In the development environment (environment=development), I started copying all the modules to wwwroot\lib manually. When that became tedious, I wrote a Gulp task to copy them. Now there are plenty of tasks. Is there any ASP.NET project setting so the modules can be loaded from the node_modules folder at the root rather than from the wwwroot\lib ? 回答1: Edit: For development purposes

Gulp tasks from within other Gulp tasks?

走远了吗. 提交于 2019-12-23 17:03:11
问题 I have a Gulp build task that is made up of other build tasks similar to this: gulp.task('build', ['build-html', 'build-css', 'build-js', 'build-images']); The thing I hate about this is that the build task doesn't run until after the dependencies are finished: Starting 'build-html'... Finished 'build-html' after 1 s Starting 'build-css'... Finished 'build-css' after 1 s Starting 'build-js'... Finished 'build-js' after 1 s Starting 'build-images'... Finished 'build-images' after 1 s Starting

Browser Sync not reloading with gulp

被刻印的时光 ゝ 提交于 2019-12-23 16:37:36
问题 I am trying to gulp browser sync as follows var liveReload = require('browser-sync').create(); //reload when something changes once scss is converted to css gulp.task('trigger-reload', ['sass'], function(){ liveReload.reload(); }); //set watchers to reload gulp.task('watch', function(){ liveReload.init({ server: { baseDir:'./' } }); gulp.watch('src/**/*.js', ['trigger-reload']); //js change }); Now when I make changes to the js file I see the following on my terminal : [00:19:23] Starting