A build tool for web projects. Features included :
- javascript files concatenation
- css files concatenation
- html files optimisation
- sass files compilation
- browserify compilation
- browser-sync
Add the project as a dev dependency :
npm install --save-dev rauricoste-gulp
Create a gulpfile.js at the root of your project and edit it.
Here is an exemple :
var conf = {
base: {
src: "app-test/src", // directory for your source files. Try not to include library files
dist: 'dist', // directory where your distribution files will be generated
test: "**/*.spec.js", // pattern of your javascript test files so that they are not included in jsConcat
watch: "app-test/src", // base directory to watch for changes for browser-sync
serve: "app-test/src" // base directory for serving your files, in addition of the dist directory
},
modules: {
main: { // name of the module. All generated files for this module will be under "dist/main"
browserify: "app-test/src/main.js", // entry point of your app to browserify
sass: "app-test/src/index.scss" // entry point of your sass files to compile
},
assets: {
css: "app-test/src", // base directory for your css files to concat
html: "app-test/src", // base directory for your html files to copy
other: "app-test/src" // base directory for your other files to copy
},
module2: {
browserify: "app-test/src/utils/module2.js",
jsConcat: "app-test/src/utils" // base directory for your javascript files to concat
}
}
};
require("rauricoste-gulp")(conf);
-
gulp
to build the modules. -
gulp serve
to build the modules and serve files with a static server and synchronize them with browser-sync.