Category Archives: Tools

How to combine css js via Gulp

How to combine css js via Gulp

This article’s going to show “How to combine css js via Gulp”

6200624

For Window Installation

1/ firstly, install nodejs
2/ then go to command line to install some modules

cmd > npm install gulp –save-dev
cmd > npm install –save-dev gulp-concat
cmd > npm install gulp-rename gulp-uglify –save-dev
cmd > npm install –save-dev del
cmd > npm install gulp-sourcemaps –save-dev
cmd > npm install –save-dev gulp-concat-css

3/ Copy or create gulpfile.js to folder where you want to put then go to command line and move to folder that contain gulpfile.js and type
cmd > gulp

if everthing is ok you will see something these lines, ctrl + C and enter Y to terminate your command!

C:\Users\HP\Desktop\tmp>gulp
[13:32:05] Using gulpfile ~\Desktop\tmp\gulpfile.js
[13:32:05] Starting ‘watch’…
[13:32:05] Finished ‘watch’ after 12 ms
[13:32:05] Starting ‘clean’…
[13:32:05] Starting ‘css’…
[13:32:05] Finished ‘clean’ after 42 ms
[13:32:05] Starting ‘scripts’…
[13:32:05] Finished ‘css’ after 93 ms
[13:32:05] Finished ‘scripts’ after 90 ms
[13:32:05] Starting ‘default’…
[13:32:05] Finished ‘default’ after 11 μs
^CTerminate batch job (Y/N)? Y

gulpfile.js content:

and you should create js/b.js, a.js, css/style.css, test.css with some files to test.

Read more:

http://codehangar.io/concatenate-and-minify-javascript-with-gulp/

https://www.npmjs.com/package/gulp