Created
April 1, 2016 10:01
-
-
Save rkorebrits/099729078bc9eea5a33427a61d0cadd9 to your computer and use it in GitHub Desktop.
Gulp issues
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "sage", | |
"homepage": "https://roots.io/sage/", | |
"authors": [ | |
"Ben Word <[email protected]>" | |
], | |
"license": "MIT", | |
"private": true, | |
"dependencies": { | |
"modernizr": "2.8.2", | |
"bootstrap-sass-official": "3.3.4", | |
"font-awesome": "~4.3.0", | |
"animate.scss": "latest", | |
"history.js": "latest", | |
"jquery.scrollTo": "latest", | |
"jssor-slider": "latest", | |
"sidr": "1.2.1", | |
"bxslider-4": "4.2.5", | |
"chosen": "1.4.2", | |
"imagesloaded": "latest", | |
"jQuery.dotdotdot": "latest", | |
"fancybox": "fancyBox#master" | |
}, | |
"overrides": { | |
"chosen": { | |
"main": [ | |
"./chosen.jquery.min.js", | |
"./chosen-sprite.png", | |
"./[email protected]" | |
] | |
}, | |
"sidr": { | |
"main": "./dist/jquery.sidr.js" | |
}, | |
"jssor-slider": { | |
"main": "./js/jssor.slider.mini.js" | |
}, | |
"jquery.scrollTo": { | |
"main": "./jquery.scrollTo.js" | |
}, | |
"history.js": { | |
"main": "./scripts/bundled/html5/jquery.history.js" | |
}, | |
"modernizr": { | |
"main": "./modernizr.js" | |
}, | |
"font-awesome": { | |
"main": [ | |
"./scss/_variables.scss", | |
"./scss/_mixins.scss", | |
"./scss/_path.scss", | |
"./scss/_core.scss", | |
"./scss/_larger.scss", | |
"./scss/_icons.scss", | |
"./fonts/fontawesome-webfont.eot", | |
"./fonts/fontawesome-webfont.svg", | |
"./fonts/fontawesome-webfont.ttf", | |
"./fonts/fontawesome-webfont.woff", | |
"./fonts/fontawesome-webfont.woff2" | |
] | |
}, | |
"animate.scss": { | |
"main": [ | |
"./scss/animate.scss" | |
] | |
}, | |
"bootstrap-sass-official": { | |
"main": [ | |
"./assets/stylesheets/bootstrap/_variables.scss", | |
"./assets/stylesheets/bootstrap/_mixins.scss", | |
"./assets/stylesheets/bootstrap/_normalize.scss", | |
"./assets/stylesheets/bootstrap/_print.scss", | |
"./assets/stylesheets/bootstrap/_glyphicons.scss", | |
"./assets/stylesheets/bootstrap/_scaffolding.scss", | |
"./assets/stylesheets/bootstrap/_alerts.scss", | |
"./assets/stylesheets/bootstrap/_type.scss", | |
"./assets/stylesheets/bootstrap/_code.scss", | |
"./assets/stylesheets/bootstrap/_grid.scss", | |
"./assets/stylesheets/bootstrap/_tables.scss", | |
"./assets/stylesheets/bootstrap/_forms.scss", | |
"./assets/stylesheets/bootstrap/_buttons.scss", | |
"./assets/stylesheets/bootstrap/_component-animations.scss", | |
"./assets/stylesheets/bootstrap/_responsive-embed.scss", | |
"./assets/stylesheets/bootstrap/_dropdowns.scss", | |
"./assets/stylesheets/bootstrap/_input-groups.scss", | |
"./assets/stylesheets/bootstrap/_navs.scss", | |
"./assets/stylesheets/bootstrap/_navbar.scss", | |
"./assets/stylesheets/bootstrap/_breadcrumbs.scss", | |
"./assets/stylesheets/bootstrap/_panels.scss", | |
"./assets/stylesheets/bootstrap/_carousel.scss", | |
"./assets/stylesheets/bootstrap/_utilities.scss", | |
"./assets/javascripts/bootstrap/transition.js", | |
"./assets/javascripts/bootstrap/alert.js", | |
"./assets/javascripts/bootstrap/button.js", | |
"./assets/javascripts/bootstrap/carousel.js", | |
"./assets/javascripts/bootstrap/collapse.js", | |
"./assets/javascripts/bootstrap/dropdown.js", | |
"./assets/javascripts/bootstrap/modal.js", | |
"./assets/javascripts/bootstrap/tooltip.js", | |
"./assets/javascripts/bootstrap/popover.js", | |
"./assets/javascripts/bootstrap/scrollspy.js", | |
"./assets/javascripts/bootstrap/tab.js", | |
"./assets/javascripts/bootstrap/affix.js", | |
"./assets/fonts/bootstrap/glyphicons-halflings-regular.eot", | |
"./assets/fonts/bootstrap/glyphicons-halflings-regular.svg", | |
"./assets/fonts/bootstrap/glyphicons-halflings-regular.ttf", | |
"./assets/fonts/bootstrap/glyphicons-halflings-regular.woff", | |
"./assets/fonts/bootstrap/glyphicons-halflings-regular.woff2" | |
] | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "chosen", | |
"description": "Chosen is a JavaScript plugin that makes long, unwieldy select boxes much more user-friendly. It is currently available in both jQuery and Prototype flavors.", | |
"version": "1.4.1", | |
"main": [ | |
"chosen.jquery.min.js", | |
"chosen.css", | |
"[email protected]", | |
"chosen-sprite.png" | |
], | |
"license": [ | |
{ | |
"type": "MIT", | |
"url": "https://github.com/harvesthq/chosen/blob/master/LICENSE.md" | |
} | |
], | |
"ignore": [], | |
"keywords": [ | |
"select", | |
"multiselect", | |
"dropdown", | |
"form", | |
"input", | |
"ui" | |
], | |
"authors": [ | |
{ | |
"name": "Patrick Filler", | |
"url": "https://github.com/pfiller" | |
}, | |
{ | |
"name": "Christophe Coevoet", | |
"url": "https://github.com/stof" | |
}, | |
{ | |
"name": "Ken Earley", | |
"url": "https://github.com/kenearley" | |
}, | |
{ | |
"name": "Koen Punt", | |
"url": "https://github.com/koenpunt" | |
} | |
], | |
"homepage": "http://harvesthq.github.io/chosen/", | |
"repository": { | |
"type": "git", | |
"url": "https://github.com/harvesthq/chosen" | |
}, | |
"dependencies": { | |
"jquery": ">=1.4.4" | |
}, | |
"devDependencies": [] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "fancybox", | |
"main": [ | |
"source/jquery.fancybox.css", | |
"source/jquery.fancybox.js", | |
"source/blank.gif", | |
"source/fancybox_loading.gif", | |
"source/[email protected]", | |
"source/fancybox_overlay.png", | |
"source/fancybox_sprite.png", | |
"source/[email protected]", | |
"source/jquery.fancybox.pack.js" | |
], | |
"ignore": [ | |
"**/.*", | |
"fancybox.jquery.json", | |
"demo" | |
], | |
"dependencies": { | |
"jquery": ">=1.10", | |
"jquery-mousewheel": "~3.1.3" | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/*global process,require,console*/ | |
// ## Globals | |
var argv = require('minimist')(process.argv.slice(2)); | |
var autoprefixer = require('gulp-autoprefixer'); | |
var browserSync = require('browser-sync').create(); | |
var changed = require('gulp-changed'); | |
var concat = require('gulp-concat'); | |
var flatten = require('gulp-flatten'); | |
var gulp = require('gulp'); | |
var gulpif = require('gulp-if'); | |
var imagemin = require('gulp-imagemin'); | |
var jshint = require('gulp-jshint'); | |
var lazypipe = require('lazypipe'); | |
var less = require('gulp-less'); | |
var merge = require('merge-stream'); | |
var minifyCss = require('gulp-minify-css'); | |
var plumber = require('gulp-plumber'); | |
var rev = require('gulp-rev'); | |
var runSequence = require('run-sequence'); | |
var sass = require('gulp-sass'); | |
var sourcemaps = require('gulp-sourcemaps'); | |
var uglify = require('gulp-uglify'); | |
// See https://github.com/austinpray/asset-builder | |
var manifest = require('asset-builder')('./assets/manifest.json'); | |
var environment = require('asset-builder')('./assets/environment.json'); | |
// `path` - Paths to base asset directories. With trailing slashes. | |
// - `path.source` - Path to the source files. Default: `assets/` | |
// - `path.dist` - Path to the build directory. Default: `dist/` | |
var path = manifest.paths; | |
// `config` - Store arbitrary configuration values here. | |
var config = environment.config || {}; | |
// `globs` - These ultimately end up in their respective `gulp.src`. | |
// - `globs.js` - Array of asset-builder JS dependency objects. Example: | |
// ``` | |
// {type: 'js', name: 'main.js', globs: []} | |
// ``` | |
// - `globs.css` - Array of asset-builder CSS dependency objects. Example: | |
// ``` | |
// {type: 'css', name: 'main.css', globs: []} | |
// ``` | |
// - `globs.fonts` - Array of font path globs. | |
// - `globs.images` - Array of image path globs. | |
// - `globs.bower` - Array of all the main Bower files. | |
var globs = manifest.globs; | |
// `project` - paths to first-party assets. | |
// - `project.js` - Array of first-party JS assets. | |
// - `project.css` - Array of first-party CSS assets. | |
var project = manifest.getProjectGlobs(); | |
// CLI options | |
var enabled = { | |
// Enable static asset revisioning when `--production` | |
rev: argv.production, | |
// Disable source maps when `--production` | |
maps: !argv.production, | |
// Fail styles task on error when `--production` | |
failStyleTask: argv.production, | |
// Fail due to JSHint warnings only when `--production` | |
failJSHint: argv.production, | |
// Strip debug statments from javascript when `--production` | |
stripJSDebug: argv.production, | |
isDev: config.env === 'dev' | |
}; | |
// Path to the compiled assets manifest in the dist directory | |
var revManifest = path.dist + 'assets.json'; | |
// ## Reusable Pipelines | |
// See https://github.com/OverZealous/lazypipe | |
// ### CSS processing pipeline | |
// Example | |
// ``` | |
// gulp.src(cssFiles) | |
// .pipe(cssTasks('main.css') | |
// .pipe(gulp.dest(path.dist + 'styles')) | |
// ``` | |
var cssTasks = function(filename) { | |
return lazypipe() | |
.pipe(function() { | |
return gulpif(!enabled.failStyleTask, plumber()); | |
}) | |
.pipe(function() { | |
return gulpif(enabled.maps, sourcemaps.init()); | |
}) | |
.pipe(function() { | |
return gulpif('*.less', less()); | |
}) | |
.pipe(function() { | |
return gulpif('*.scss', sass({ | |
outputStyle: 'nested', // libsass doesn't support expanded yet | |
precision: 10, | |
includePaths: ['.'], | |
errLogToConsole: !enabled.failStyleTask | |
})); | |
}) | |
.pipe(concat, filename) | |
.pipe(function(){ | |
return gulpif(!enabled.isDev, autoprefixer({ | |
browsers: [ | |
'last 2 versions', | |
'ie 8', | |
'ie 9', | |
'android 2.3', | |
'android 4', | |
'opera 12' | |
] | |
})); | |
}) | |
.pipe(function(){ | |
return gulpif(!enabled.isDev, minifyCss({ | |
advanced: false, | |
rebase: false | |
})); | |
}) | |
.pipe(function() { | |
return gulpif(enabled.rev && !enabled.isDev, rev()); | |
}) | |
.pipe(function() { | |
return gulpif(enabled.maps && !enabled.isDev, sourcemaps.write('.', { | |
sourceRoot: 'assets/styles/' | |
})); | |
})(); | |
}; | |
// ### JS processing pipeline | |
// Example | |
// ``` | |
// gulp.src(jsFiles) | |
// .pipe(jsTasks('main.js') | |
// .pipe(gulp.dest(path.dist + 'scripts')) | |
// ``` | |
var jsTasks = function(filename) { | |
return lazypipe() | |
.pipe(function() { | |
return gulpif(enabled.maps, sourcemaps.init()); | |
}) | |
.pipe(concat, filename) | |
.pipe(function(){ | |
return gulpif(!enabled.isDev, uglify({ | |
compress: { | |
'drop_debugger': enabled.stripJSDebug | |
} | |
}) | |
); | |
}) | |
.pipe(function() { | |
return gulpif(enabled.rev, rev()); | |
}) | |
.pipe(function() { | |
return gulpif(enabled.maps, sourcemaps.write('.', { | |
sourceRoot: 'assets/scripts/' | |
})); | |
})(); | |
}; | |
// ### Write to rev manifest | |
// If there are any revved files then write them to the rev manifest. | |
// See https://github.com/sindresorhus/gulp-rev | |
var writeToManifest = function(directory) { | |
return lazypipe() | |
.pipe(gulp.dest, path.dist + directory) | |
.pipe(browserSync.stream, {match: '**/*.{js,css}'}) | |
.pipe(rev.manifest, revManifest, { | |
base: path.dist, | |
merge: true | |
}) | |
.pipe(gulp.dest, path.dist)(); | |
}; | |
// ## Gulp tasks | |
// Run `gulp -T` for a task summary | |
// ### Styles | |
// `gulp styles` - Compiles, combines, and optimizes Bower CSS and project CSS. | |
// By default this task will only log a warning if a precompiler error is | |
// raised. If the `--production` flag is set: this task will fail outright. | |
gulp.task('styles', ['wiredep'], function() { | |
var merged = merge(); | |
manifest.forEachDependency('css', function(dep) { | |
var cssTasksInstance = cssTasks(dep.name); | |
if (!enabled.failStyleTask) { | |
cssTasksInstance.on('error', function(err) { | |
console.error(err.message); | |
this.emit('end'); | |
}); | |
} | |
merged.add(gulp.src(dep.globs, {base: 'styles'}) | |
.pipe(cssTasksInstance)); | |
}); | |
return merged | |
.pipe(writeToManifest('styles')); | |
}); | |
// ### Scripts | |
// `gulp scripts` - Runs JSHint then compiles, combines, and optimizes Bower JS | |
// and project JS. | |
gulp.task('scripts', ['jshint'], function() { | |
var merged = merge(); | |
manifest.forEachDependency('js', function(dep) { | |
merged.add( | |
gulp.src(dep.globs, {base: 'scripts'}) | |
.pipe(jsTasks(dep.name)) | |
); | |
}); | |
return merged | |
.pipe(writeToManifest('scripts')); | |
}); | |
// ### Fonts | |
// `gulp fonts` - Grabs all the fonts and outputs them in a flattened directory | |
// structure. See: https://github.com/armed/gulp-flatten | |
gulp.task('fonts', function() { | |
return gulp.src(globs.fonts) | |
.pipe(flatten()) | |
.pipe(gulp.dest(path.dist + 'fonts')) | |
.pipe(browserSync.stream()); | |
}); | |
// ### Images | |
// `gulp images` - Run lossless compression on all the images. | |
gulp.task('images', function() { | |
return gulp.src(globs.images) | |
.pipe(imagemin({ | |
progressive: true, | |
interlaced: true, | |
svgoPlugins: [{removeUnknownsAndDefaults: false}, {cleanupIDs: false}] | |
})) | |
.pipe(gulp.dest(path.dist + 'images')) | |
.pipe(browserSync.stream()); | |
}); | |
// ### JSHint | |
// `gulp jshint` - Lints configuration JSON and project JS. | |
gulp.task('jshint', function() { | |
return gulp.src([ | |
'bower.json', 'gulpfile.js' | |
].concat(project.js)) | |
.pipe(jshint()) | |
.pipe(jshint.reporter('jshint-stylish')) | |
.pipe(gulpif(enabled.failJSHint, jshint.reporter('fail'))); | |
}); | |
// ### Clean | |
// `gulp clean` - Deletes the build folder entirely. | |
gulp.task('clean', require('del').bind(null, [path.dist])); | |
// ### Watch | |
// `gulp watch` - Use BrowserSync to proxy your dev server and synchronize code | |
// changes across devices. Specify the hostname of your dev server at | |
// `manifest.config.devUrl`. When a modification is made to an asset, run the | |
// build step for that asset and inject the changes into the page. | |
// See: http://www.browsersync.io | |
gulp.task('watch', function() { | |
browserSync.init({ | |
files: ['{lib,templates}/**/*.php', '*.php'], | |
proxy: config.devUrl, | |
open: false, | |
snippetOptions: { | |
whitelist: ['/wp-admin/admin-ajax.php'], | |
blacklist: ['/wp-admin/**'] | |
} | |
}); | |
gulp.watch([path.source + 'styles/**/*'], ['styles']); | |
gulp.watch([path.source + 'scripts/**/*'], ['jshint', 'scripts']); | |
gulp.watch([path.source + 'fonts/**/*'], ['fonts']); | |
gulp.watch([path.source + 'images/**/*'], ['images']); | |
gulp.watch(['bower.json', 'assets/manifest.json'], ['build']); | |
}); | |
// ### Build | |
// `gulp build` - Run all the build tasks but don't clean up beforehand. | |
// Generally you should be running `gulp` instead of `gulp build`. | |
gulp.task('build', function(callback) { | |
runSequence('styles', | |
'scripts', | |
['fonts', 'images'], | |
callback); | |
}); | |
// ### Wiredep | |
// `gulp wiredep` - Automatically inject Less and Sass Bower dependencies. See | |
// https://github.com/taptapship/wiredep | |
gulp.task('wiredep', function() { | |
var wiredep = require('wiredep').stream; | |
return gulp.src(project.css) | |
.pipe(wiredep()) | |
.pipe(changed(path.source + 'styles', { | |
hasChanged: changed.compareSha1Digest | |
})) | |
.pipe(gulp.dest(path.source + 'styles')); | |
}); | |
// ### Gulp | |
// `gulp` - Run a complete build. To compile for production run `gulp --production`. | |
gulp.task('default', ['clean'], function() { | |
//console.log(process.env.NODE_ENV); | |
gulp.start('build'); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment