Skip to content

Instantly share code, notes, and snippets.

@AndrewAllison
Created February 10, 2016 09:18
Show Gist options
  • Save AndrewAllison/42ab1075d39e261b79bf to your computer and use it in GitHub Desktop.
Save AndrewAllison/42ab1075d39e261b79bf to your computer and use it in GitHub Desktop.
Gulp & bower build package
{
"directory": "lib",
"scripts": {
"postinstall": "gulp wiredep"
}
}
{
"bitwise": true,
"camelcase": true,
"curly": true,
"eqeqeq": true,
"es3": false,
"forin": true,
"freeze": true,
"immed": true,
"indent": 4,
"latedef": "nofunc",
"newcap": true,
"noarg": true,
"noempty": true,
"nonbsp": true,
"nonew": true,
"plusplus": false,
"quotmark": "single",
"undef": true,
"unused": false,
"strict": false,
"maxparams": 10,
"maxdepth": 5,
"maxstatements": 40,
"maxcomplexity": 8,
"maxlen": 120,
"asi": false,
"boss": false,
"debug": false,
"eqnull": true,
"esnext": false,
"evil": false,
"expr": false,
"funcscope": false,
"globalstrict": false,
"iterator": false,
"lastsemic": false,
"laxbreak": false,
"laxcomma": false,
"loopfunc": true,
"maxerr": 50,
"moz": false,
"multistr": false,
"notypeof": false,
"proto": false,
"scripturl": false,
"shadow": false,
"sub": true,
"supernew": false,
"validthis": false,
"noyield": false,
"browser": true,
"node": true,
"globals": {
"angular": false
}
}
{
"name": "OneView",
"version": "1.0.0-Alpha-1",
"authors": [
"Andrew Allison <[email protected]>"
],
"description": "Onyx OneView Dashboard",
"main": "index.html",
"moduleType": [],
"license": "MIT",
"homepage": "",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular-animate": "~1.4.7",
"moment": "~2.10.6",
"angular-moment": "~0.10.3",
"bootstrap": "~3.3.5",
"angular-ui-router": "~0.2.15",
"font-awesome": "~4.4.0",
"toastr": "~2.1.2",
"log4javascript": "~1.4.9",
"angular-local-storage": "~0.2.2",
"animate.css": "~3.4.0",
"angular-bootstrap": "~1.1.2",
"satellizer": "~0.12.5",
"chance": "~0.8.0",
"angular-gravatar": "~0.4.1",
"ngSlimscroll": "*",
"ng-office-ui-fabric": "~0.1.3",
"ui-select": "angular-ui-select#~0.13.2",
"angular-sanitize": "~1.4.8"
}
}
module.exports = function () {
var bower = {
json: require('./bower.json'),
directory: './lib/',
ignorePath: '../..'
};
var packages = [
'./package.json',
'./bower.json'
];
var app = './app/';
var css = [
app + '/**/template.css',
app + '/**/app.css',
app + '/**/*.css',
'!' + app + '/**/*.min.css',
'!' + app + '/**/*_partial.css'
];
var index = 'index.html';
var js = [
app + '**/app.js',
app + '**/*.module.js',
app + '**/*.js',
'!' + app + '**/*.spec.js',
'!' + app + '**/*.templates.js'
];
var root = './';
var watchFiles = [
app + '**/*.js',
app + '**/*.css'
];
var config = {
/**
* File Paths
*/
app: app,
css: css,
index: root + index,
js: js,
root: root,
watchFiles: watchFiles,
/**
* Bower and NPM files
*/
bower: bower,
packages: packages
}
/**
* wiredep and bower settings
*/
config.getWiredepDefaultOptions = function () {
return {
bowerJson: config.bower.json,
directory: config.bower.directory,
ignorePath: config.bower.ignorePath
};
};
return config;
};
/// <vs SolutionOpened='watch' />
/// <binding ProjectOpened='watch' />
/// <vs BeforeBuild='inject, wiredep' SolutionOpened='watch' />
var config = require('./gulp.config')();
var gulp = require('gulp');
/* Save loading all gulp plugins mannually */
var $ = require('gulp-load-plugins')({ lazy: true });
var colors = $.util.colors;
/**
* Wire-up the bower dependencies
* @return {Stream}
*/
gulp.task('wiredep', function () {
log('Wiring the bower dependencies into the html');
var wiredep = require('wiredep').stream;
var options = config.getWiredepDefaultOptions();
return gulp
.src(config.index)
.pipe(wiredep(options))
.pipe(gulp.dest(config.root));
});
/**
* inject css and js from folders
* @return {Stream}
*/
gulp.task('inject', [], function () {
log('inject files css/js into the index.');
return gulp
.src(config.index)
.pipe($.inject(gulp.src(config.js), { read: false, relative: true }))
.pipe($.inject(gulp.src(config.css), { read: false, relative: true }))
.pipe(gulp.dest(config.root));
});
/**
* Watch for Js and CSS files being added
* @return {Stream}
*/
gulp.task('watch', function () {
var watch = require('gulp-watch');
watch(config.watchFiles, { events: ['add', 'unlink'] }, function () {
gulp.start('inject');
});
});
/**
* Log a message or series of messages using chalk's blue color.
* Can pass in a string, object or array.
*/
function log(msg) {
if (typeof (msg) === 'object') {
for (var item in msg) {
if (msg.hasOwnProperty(item)) {
$.util.log($.util.colors.blue(msg[item]));
}
}
} else {
$.util.log($.util.colors.blue(msg));
}
}
{
"name": "oneview",
"version": "1.0.0-alpha-1",
"description": "OneView",
"main": "index.html",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"devDependencies": {
"bower": "^1.3.3",
"gulp": "^3.9.0",
"gulp-inject": "^1.5.0",
"gulp-load-plugins": "^1.0.0-rc.1",
"gulp-concat": "^2.2.0",
"gulp-rename": "^1.2.0",
"gulp-util": "^3.0.6",
"gulp-watch": "^4.3.5",
"wiredep": "^3.0.0-beta",
"shelljs": "^0.3.0"
},
"author": "",
"license": "ISC",
"dependencies": {
"gulp": "^3.9.0",
"gulp-load-plugins": "^0.10.0"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment