gulp.task('content', function() { return gulp.src('app/**/*.jade') .pipe(jade().on('error', util.log)) .pipe(embedlr()) .pipe(gulp.dest('./build/')) .pipe(livereload()) })
gulp.task('templates', function() { gulp.src('./src/*.html') // Embed livereload snippet .pipe(embedlr()) .pipe(gulp.dest('./build')) .pipe(livereload()); });
gulp.task('views', function () { gulp.src('index.html') .pipe(gulpif(watching, embedlr())) .pipe(gulp.dest(getDistDirectory())); gulp.src('views/**/*') .pipe(gulp.dest(getDistDirectory() + 'views/')) .pipe(gulpif(watching, refresh(lrserver))); });
.pipe(through(function(file) { gulp.src(file.path+'/src/*.html') .pipe(embedlr()) .pipe(gulp.dest(file.path + '')) .pipe(refresh(lr)); }));
gulp.task('jade', function () { return gulp.src('./src/jade/**/*.jade') .pipe(jade({ 'pretty': true, 'locals': database })) .pipe(gulpif(!live, embedlr())) .pipe(gulp.dest('./dist')); });
gulp.task('templates', function () { // Compile Jade files return gulp.src('src/index.jade') .pipe(jade()) .pipe(rename('index.html')) .pipe(embedlr()) .pipe(gulp.dest('app/')) .pipe(refresh(lr)); });
gulp.task("jade", function () { gulp.src("templates/**/*.jade") .pipe(jade({ locals: getPageOptions() })) .on("error", errorhandler("jade")) .pipe(embedlr()) .pipe(gulp.dest("./")); });
gulp.task('html', function() { gulp.src(jadeFiles) .pipe(jade({})) .pipe(embedlr({ src: 'http://localhost:' + lrPort + '/livereload.js?snipver=1' })) .pipe(minifyHTML()) .pipe(gulp.dest(buildDir)) .pipe(refresh(lrServer)); });
function index() { del.sync(paths.index.dist + "/index.html"); return gulp.src(paths.index.src) .pipe(plumber()) .pipe(jade({pretty: DEV})) .pipe(gulpif(DEV, embedlr())) .pipe(gulp.dest(paths.index.dist)) .pipe(gulpif(DEV, livereload())); }
gulp.task('jade', function(){ return gulp.src(['./src/jade/**/*.jade', '!**/_*', '!src/jade/patterns/', '!src/jade/patterns/**']) .pipe(jade({ pretty : true })) .pipe(embedlr()) .pipe(gulp.dest('./src/')) ; })
})).on('finish', function(){ browserify("./doc/main.js") .bundle({debug: true}).on('error', notify.onError({ message: "Error: <%= error.message %>", title: "Failed running browserify" })).on('prebundle', function(bundle) { console.log("prebundle!"); }) .pipe(source('doc.js')) .pipe(embedlr()) .pipe(gulp.dest('doc')); });
function buildTask( ){ return gulp .src( "client/index.html" ) .pipe( plumber( ) ) .pipe( replace( INCLUDE_SCRIPT_PATTERN, INCLUDE_SCRIPT_REPLACER ) ) .pipe( replace( INCLUDE_STYLE_PATTERN, INCLUDE_STYLE_REPLACER ) ) .pipe( replace( MINIFIED_SCRIPT_PATTERN, ".js" ) ) .pipe( replace( MINIFIED_STYLE_PATTERN, ".css" ) ) .pipe( replace( DEVELOPMENT_MODE_PATTERN, DEVELOPMENT_MODE_REPLACER ) ) .pipe( embedlr( ) ) .pipe( gulp.dest( "build" ) ); } );
})).on('finish', function(){ browserify("./src/main.js") .bundle({standalone: "YASQE", debug: true}).on('error', notify.onError({ message: "Error: <%= error.message %>", title: "Failed running browserify" })).on('prebundle', function(bundle) { console.log("prebundle!"); }) .pipe(source(outputName + '.js')) .pipe(embedlr()) .pipe(gulp.dest(dest)) .pipe(connect.reload()); });
gulp.task('browserifyForDebug', function() { var bundler = browserify({entries: ["./src/entry.js"],standalone: "fed-data-client", debug: true}); return bundler .transform({global:true}, shim) .bundle() .on("error", notify.onError(function(error) { return error.message; })) .pipe(source(paths.bundleName + '.min.js')) .pipe(embedlr()) .pipe(gulp.dest(paths.bundleDir)) .pipe(connect.reload()); });
gulp.task('build-main', ['build-scripts', 'build-styles', 'build-html', 'imagemin', 'copy-icon'], function() { return gulp.src('./src/jade/index.jade') .pipe(jade({ pretty: true })) .pipe(gulpif(config.livereload, embedlr())) .pipe(inject(gulp.src(['./app/scripts/**/*.js', './app/styles/*.css'], { read: false }), { ignorePath: '/app/', addRootSlash: false })) .pipe(gulp.dest(dest)); // .pipe(livereload()); });
action() { return merge( gulp.src(this._buildManager.options.views + '/**/*.html') .pipe(changed(this._buildManager.getTemporaryDirectory() + this._buildManager.options.views + '/')) .pipe(gulp.dest(this._buildManager.getTemporaryDirectory() + this._buildManager.options.views + '/')) .pipe(refresh({ start: this._buildManager.isWatching(), port: this._buildManager.options.liveReloadPort })), gulp.src('index.html') .pipe(gulpif(this._buildManager.isWatching(), embedlr({ port: this._buildManager.options.liveReloadPort }))) .pipe(gulp.dest(this._buildManager.getTemporaryDirectory())) ); }
gulp.task('build-views', function() { gutil.log('... building views'); var indexFilter = filter('index.html'); return gulp.src(opts.paths.client.statics) .pipe(cached('views')) // only copy files that have changed .pipe(indexFilter) .pipe(gulpif(!opts.production && opts.watching, embedlr({ port: opts.lrPort, src: 'http://localhost:' + opts.lrPort + '/livereload.js?snipver=1' }))) .pipe(indexFilter.restore()) .pipe(gulp.dest(opts.paths.client.target)) .pipe(plumber()) .pipe(livereload(opts.lr, {auto:false})) ; });
var buildHTML = function() { var htmlFile = readFile(join(cfg.srcDir, cfg.indexFile)); return gulp.src([join(cfg.srcDir, '/**/*.*'), '!' + join(cfg.srcDir, cfg.indexFile)], {read: false}) .pipe(plumber()) .pipe(inject(cfg.appFiles.html, { addRootSlash: false, sort: fileSorter, // see below ignorePath: join('/',cfg.buildDir,'/') })) .pipe(_if(embedLR, livereloadEmbed({port: cfg.server.lrPort}))) .pipe(gulp.dest(cfg.buildDir)) .pipe(tap(function(file) { var newHtmlFile = file.contents.toString(); if(newHtmlFile !== htmlFile) { htmlFile = newHtmlFile; //gulp.src(file.path).pipe(livereload(server)); } })); };
return function () { var embedlr = require('gulp-embedlr'), gulp = require('gulp'), gulpif = require('gulp-if'), handlebars = require('gulp-compile-handlebars'), minhtml = require('gulp-htmlmin'), path = require('path'); var c = require('./config'); var manifest; if (minify) { manifest = require(path.join('..', c.target("rev-manifest.json"))); for (var key in manifest) { // replace full path in key, so only app.js and app.css are left var newkey = key.replace(/.*\//, ""); manifest[newkey] = manifest[key]; delete manifest[key]; } } var templateData = c.FILES_REV.reduce(function (acc, conf) { acc[conf.name] = minify ? manifest[conf.targetFile] : conf.entryPath; return acc; }, {}); return gulp.src(c.PATH_INDEX) .pipe(gulpif(!minify, embedlr())) .pipe(handlebars(templateData)) .pipe(gulpif(minify, minhtml({ // https://github.com/jonschlinkert/gulp-htmlmin collapseWhitespace: true, removeComments: true, minifyCSS: true, minifyJS: true, }))) .pipe(gulp.dest(c.target())); };
gulp.task('html', function() { function isIndexDevMode(file) { return (file.path == path.join(__dirname, 'app/index.html')) && isDevelopment; } return gulp.src('app/**/*.html') .pipe(changed('./dist')) .pipe(gulpif(isIndexDevMode, embedlr({ port: lrOptions.port }))) .pipe(minifyHTML({ collapseWhitespace: true, collapseBooleanAttributes: true, removeCommentsFromCDATA: true, removeOptionalTags: true, conditionals: true, quotes: true, empty: true })) .pipe(gulp.dest('dist')) .pipe(livereload()); });
module.exports = function() { return browserify('./src/main.js' // { // entries: ['./src/javascript/app.coffee'], // extensions: ['.coffee', '.hbs'] // } ) // browserify('./src/main.js').bundle({standalone: "Yasqe", debug: true}) // .pipe(source('bundle.js')) // .pipe(gulp.dest(dest)); // // .require('backbone/node_modules/underscore', { expose: 'underscore' }) .bundle({standalone: "Yasqe", debug: true}) .on('error', notify.onError({ message: "<%= error.message %>", title: "JavaScript Error" })) .pipe(source('app.js')) .pipe(embedlr()) .pipe(gulp.dest('./build/')) .pipe(livereload()); };
return function html () { var embedlr = require('gulp-embedlr'), del = require('del'), gulp = require('gulp'), gulpif = require('gulp-if'), minhtml = require('gulp-htmlmin'), path = require('path'); var c = require('./config'); return gulp.src(c.PATH_INDEX) .pipe(gulpif(!minify, embedlr())) .pipe(gulpif(minify, minhtml({ // https://github.com/jonschlinkert/gulp-htmlmin collapseWhitespace: true, removeComments: true, minifyCSS: true, minifyJS: true, }))) .pipe(gulp.dest(c.target())); };
gulp.task('html', function() { gulp.src("*.html") .pipe(embedlr()) .pipe(gulp.dest('build')) .pipe(refresh(server)); })
function devHtmlLivereload() { return gulp.src( paths.dest.index ) .pipe( embedlr({ port : LIVE_RELOAD_PORT }) ) .pipe( gulp.dest( paths.dest.indexPath ) ); }
gulp.task('html', function() { return gulp.src(config.src_html) .pipe(embedlr()) .pipe(gulp.dest('dist/')) .pipe(livereload(server)) });
gulp.task('html', function() { gulp.src("app/*.html") .pipe(embedlr()) .pipe(gulp.dest('dist/')) .pipe(refresh(server)); })
gulp.task( 'embedlr', function() { gulp.src( src + "*.html" ) .pipe( embedlr() ) .pipe( gulp.dest( dist ) ) .pipe( livereload( server ) ); });
gulp.task('build-markup-with-livereload', function () { var embedlr = require("gulp-embedlr"); gulp.src(paths.markup) .pipe(embedlr()) .pipe(gulp.dest(paths.dist)); });
gulp.task("html", function() { gulp.src("./src/index.html") .pipe(embedlr()) .pipe(gulp.dest("./build/")) .pipe(livereload()) })