0.8.0 • Published 6 years ago
mv-builder v0.8.0
MvBuilder
Collection of configured gulp tasks in one place. Great when having many projects with same building process.
gulp.config.js
module.exports = function () {
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: this.temp + '/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 = require('gulp'),
config = require('./gulp.config')(),
buildConfig = require('./build.config')(config),
mvBuilder = require('mv-builder')(gulp, config, buildConfig);
build.config.js
module.exports = function(config) {
return {
rjsOptions: getRjsOptions(),
bundlesConfig: getMainJsBundlesConfig(),
standaloneFiles: getStandaloneFiles()
};
/**
* Options passed to r.js
*
* "modules" config is a skeleton configuration, which is configured on build, by scanning module directories
* and parsing files
*/
function getRjsOptions() {
//NOTE: keys prefixed with '$' are not standard r.js options - these are used for config enhancement in gulp
return {
baseUrl: config.scripts,
mainConfigFile: config.scripts + '/main.js',
dir: config.rjsTemp,
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).
*/
function getMainJsBundlesConfig() {
return {
'app.bundle': [
'providerConfig',
'routeConfig'
]
};
}
/**
* Files not included in any bundle/module
*/
function getStandaloneFiles() {
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.
0.8.0
6 years ago
0.7.0
7 years ago
0.6.4
8 years ago
0.6.3
8 years ago
0.6.2
8 years ago
0.6.1
8 years ago
0.6.0
8 years ago
0.4.10
8 years ago
0.4.9
8 years ago
0.2.6
8 years ago
0.2.5
8 years ago
0.5.3
9 years ago
0.5.1
9 years ago
0.2.4
9 years ago
0.2.3-develop
9 years ago
0.4.8
9 years ago
0.4.6
9 years ago
0.4.4
9 years ago
0.4.3
9 years ago
0.2.3
9 years ago
0.2.2-develop
9 years ago
0.5.0
9 years ago
0.2.2
9 years ago
0.4.2
9 years ago
0.4.1
10 years ago
0.4.0
10 years ago
0.3.1
10 years ago
0.3.0
10 years ago
0.2.1
10 years ago
0.2.0
10 years ago
0.1.3
10 years ago
0.1.2
10 years ago
0.1.0
10 years ago