MvBuilder
Collection of configured gulp tasks in one place. Great when having many projects with same building process.
gulp.config.js
module { var root = __dirname + '/'; var config = /* Common direcotries */ root: root // Root app: root + 'app' // Application sources folder dist: root + 'dist' // Application distribution folder temp: root + '.tmp' // Temp folder location /* When using SASS preprocesor */ sassSrc: root + 'app/sass/**/*.scss' // This is where sass files are located sassDest: root + 'app/styles' // This is where compiled sass goes compassMixins: 'app/libs/compass-mixins/lib' // Compass mixins location /* When using LESS preprocessor */ lessSrc: root + 'app/less/**/*.less' // This is where less files are located lessDest: root + 'app/styles/' // This is where compiled less goes bundledCss: 'main.css' // This is a bundled CSS file name /* Plugins config */ autoprefixerRules: 'last 1 version' '> 1%' 'ie 10' 'ie 9' 'ie 8' 'ie 7' // Autoprefixer rules // Documentation for autoprefixerRules: https://github.com/ai/browserslist indexHtml: root + 'app/index.html' // Location of index.html file (main file of application) mainJs: root + '.tmpTS/scripts/main.js' // Location of main.js file in TS temp allJs: root + 'app/scripts/**/*.js' // Location of all JS files allViews: root + 'app/views/**/*.html' // Location of all views allViewsDest: thistemp + '/scripts' // Optional: Location for copying views files allImages: root + 'app/img/**/*' // Location of all images dependenciesFonts: root + 'app/libs/visma-nc3/dist/fonts/*' // Location of depending fonts dependenciesImages: root + 'app/libs/visma-nc3/dist/img/**/*' // Location of depending images sniffForTranslations: 'app/scripts/**/*.js' 'app/views/**/*.html' '!app/scripts/controllers/admin/**/*' '!app/views/admin/**/*' // Files used to sniff missing translations translationFiles: root + 'app/translations/*.json' // Actual translation json files jshintrc: root + '.jshintrc' // JSHint rules file karmaConfig: root + 'karma.conf.js' // Karma config file scripts: root + '.tmpTS/scripts' tmpTS: root + '.tmpTS' rjsTemp: root + 'app/scripts/temp' tempScripts: root + '.tmp/scripts' serveTmp: root + 'watch' ; return config;};
gulp.js
'use strict'; var gulp = config = buildConfig = config mvBuilder = gulp config buildConfig;
build.config.js
module { return rjsOptions: bundlesConfig: standaloneFiles: ; /** * Options passed to r.js * * "modules" config is a skeleton configuration, which is configured on build, by scanning module directories * and parsing files */ { //NOTE: keys prefixed with '$' are not standard r.js options - these are used for config enhancement in gulp return baseUrl: configscripts mainConfigFile: configscripts + '/main.js' dir: configrjsTemp optimize: 'none' // minification will be done in next build steps // exclude from bundling paths: 'shared/globalHelpers': 'empty:' 'config': 'empty:' // main modules configuration modules: // app bundle combines all .module and .config files name: 'app' name: 'libs.all' $excludeLibs: false $path: 'core' $name: 'bootstrapper' $path: 'timeReporting/absenceOverview' $path: 'shared/components' $path: 'shared/filters' name: 'standardConfigExample' include: exclude: ; } /** * Configuration inserted to main.js. * * Custom includes should be added here. * * This config is filled/extended in gulp with data from modules config (rjsOptions). */ { return 'app.bundle': 'providerConfig' 'routeConfig' ; } /** * Files not included in any bundle/module */ { return 'main' 'shared/globalHelpers' 'shims/*' ; }};
Available task
List of available tasks:
gulp
- list all available tasksgulp build
- builds projectgulp jshint
- validates all js files with jshintgulp jscs
- validates all js files with csgulp vet
- triggers jscs and jshint tasksgulp karma
- triggers karma test runnergulp translations
- checks for missing translationsgulp build
- handles all building related tasks and produces dist foldergulp compile-less
- compiles LESS filesgulp watch-less
- watches for LESS files changes and triggers compile-less task on themgulp compile-sass
- compiles SASS filesgulp watch-sass
- watches for SASS files changes and triggers compile-sass task on themgulp allJs
- generates *.all.js files for shared modulesgulp watch
- creates temp folder and watches for source changes. Transpiles JS files, compiles LESS/SASS, copies files, etc.