return function () { let bsHasInstance = global.development && bs.has(options.bs.instance); let bsInstance, interval; if (bsHasInstance) { bsInstance = bs.get(options.bs.instance); interval = setInterval(function () { bsInstance.notify('<span style="color:red">HTML is compiles...</span>', 2000); }, 1000); } let pipeline = gulp.src(src) .pipe(data(getData)).on('error', notify) .pipe(twig({ base : [path.join(options.root.src, options.twig.src)], functions: functions, })).on('error', notify) .pipe(resolver(options.twig.resolver)) .pipe(changed({firstPass: true})) .pipe(gulp.dest(build)); if (bsHasInstance) { pipeline = pipeline.on('end', function () { clearInterval(interval); bsInstance.reload(); }); } return pipeline; };
export default function processCSS() { return gulp.src(project.cssProcessor.source) .pipe(changedInPlace({firstPass: true})) .pipe(sourcemaps.init()) .pipe(stylus()) .pipe(build.bundle()); }
function buildPluginJavaScript() { return gulp.src(project.customPlugins.source) .pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')})) .pipe(changedInPlace({firstPass: true})) .pipe(babel(project.transpiler.options)) .pipe(gulp.dest('plugins/')) }
module.exports = gulp.task('images', function() { return gulp.src([ config.paths.imageSrc + '**/*' ]) .pipe(changedInPlace({ firstPass: true })) .pipe(imagemin([ imagemin.jpegtran({ progressive: true }), imagemin.svgo({ plugins: [ { cleanupIDs: false }, { collapseGroups: false }, { mergePaths: false }, { moveElemsAttrsToGroup: false }, { moveGroupAttrsToElems: false }, { removeUselessStrokeAndFill: false }, { removeViewBox: false } ] }), imagemin.gifsicle(), imagemin.optipng() ] )) .pipe(gulp.dest(config.paths.imageDist)); });
export default function processMarkup() { return gulp.src(project.markupProcessor.source) .pipe(changedInPlace({firstPass: true})) .pipe(sourcemaps.init()) .pipe(jade()) .pipe(build.bundle()); }
function configurePluginEnvironment() { let env = CLIOptions.getEnvironment(); return gulp.src(`aurelia_project/environments/${env}.js`) .pipe(changedInPlace({firstPass: true})) .pipe(rename('environment.js')) .pipe(gulp.dest(project.paths.root)); }
export default function processCSS() { return gulp.src(project.cssProcessor.source) .pipe(changedInPlace({firstPass: true})) .pipe(plumber({ errorHandler: notify.onError('Error: <%= error.message %>') })) .pipe(sourcemaps.init()) .pipe(less()) .pipe(build.bundle()); }
export default function processMarkup() { return gulp.src(project.markupProcessor.source) .pipe(changedInPlace({firstPass:true})) .pipe(htmlmin({ removeComments: true, collapseWhitespace: true, minifyCSS: true, minifyJS: true })) .pipe(build.bundle()); }
return function () { return gulp.src(options.bower.src) .pipe(bower('**/*.css')) .pipe(sourcemaps.init()) .pipe(concat(options.bower.css.output)) .pipe(changed({firstPass: true})) .pipe(autoprefixer(options.autoprefixer)) .pipe(cleanCSS({format: 'keep-breaks', zIndex: false})) .pipe(sourcemaps.write('.')) .pipe(gulp.dest(destination)); };
return function (done) { gulp.src(options.bower.src) .pipe(bower('**/*.js')) // .pipe(sourcemaps.init()) .pipe(uglify()) .pipe(concat(options.bower.js.output)) .pipe(changed({firstPass: true})) // .pipe(sourcemaps.write('.')) .pipe(gulp.dest(destination)) .on('end', function () { done(); }); };
gulp.task('scss:fix', () => { if (IS_PRODUCTION) { return; } return gulp .src(SCSS_GLOB) .pipe(changedInPlace()) .pipe(errorPlugin()) .pipe(postcss([sortPlugin], { syntax: require('postcss-scss') })) .pipe( prettier({ parser: 'postcss', }) ) .pipe(gulp.dest(SCSS_PATH)); });
export default function processCSS() { let bootstrap = path.join(process.cwd(), 'node_modules', 'bootstrap', 'scss'); let theme = path.join(process.cwd(), 'src', 'theme'); return gulp.src(project.cssProcessor.source) .pipe(changedInPlace({firstPass:true})) //.pipe(sourcemaps.init()) .pipe(sass({ includePaths: [ bootstrap, theme ] }).on('error', sass.logError)) .pipe(build.bundle()); }
export default function copyFiles(done) { if (typeof project.build.copyFiles !== 'object') { done(); return; } const instruction = getNormalizedInstruction(); const files = Object.keys(instruction); return gulp.src(files) .pipe(changedInPlace({ firstPass: true })) .pipe(gulp.dest(x => { const filePath = prepareFilePath(x.path); const key = files.find(f => f === filePath); return instruction[key]; })); }
export default function processMarkup() { return gulp.src(project.markupProcessor.source) .pipe(plumber({errorHandler: notify.onError('Error: <%= error.message %>')})) .pipe(changedInPlace({firstPass:true})) .pipe(htmlmin({ removeComments: true, collapseWhitespace: true, collapseInlineTagWhitespace: true, collapseBooleanAttributes: true, removeAttributeQuotes: true, minifyCSS: true, minifyJS: true, removeScriptTypeAttributes: true, removeStyleLinkTypeAttributes: true, ignoreCustomFragments: [/\${.*?}/g] // ignore interpolation expressions })) .pipe(build.bundle()); }
gulp.task('minifyHTML', function(){ return gulp.src(HTML_PATH) .pipe(changedInPlace({firstPass: true})) .pipe(minifyHTML({collapseWhitespace: true})) .pipe(gulp.dest(DEST)); });
function copyResourceFiles() { return gulp.src(project.customPlugins.resources) .pipe(changedInPlace({firstPass: true})) .pipe(gulp.dest('plugins/')) }
gulp.task('copy', () => gulp.src(['src/**/*', '!src/**/*.es6']) .pipe( /*only*/ changed /*files*/ ({ /*after*/ firstPass: true })) .pipe(gulp.dest('lib')));