示例#1
0
function buildHtmlEmails() {
    return gulp.src('./src/emails/**/*.html')
        .pipe(inlineCss({
            // applies inlining to <style> tags
            applyStyleTags: false,

            // applies inlining to external <link> css
            applyLinkTags: true,

            // removes <style> tags
            removeStyleTags: true,

            // removes <link> tags
            removeLinkTags: true,

            // preserves any media queries in style tags when removeStyleTags is true
            preserveMediaQueries: true,

            // takes css pixel width and applies it as attribute
            applyWidthAttributes: true,

            // adds border,cellpadding,cellspacing = 0 to all tables
            applyTableAttributes: false,

            // removes class and id attributes from html
            removeHtmlSelectors: false
        }))
        .pipe(htmlEmailCustom()) // custom gulp plugin I wrote to do various things...
        .pipe(htmlmin({collapseWhitespace: true}))
        // .pipe(litmus(require('./config/litmus.config')))
        .pipe(gulp.dest('./build/'));
}
gulp.task('inline', function() {
  return gulp.src(paths.html)
    .pipe(inlinesource())
    .pipe(inlineCss({
      preserveMediaQueries: true
    }))
    .pipe(gulp.dest(paths.dist));
});
示例#3
0
文件: gulpfile.js 项目: bartuspan/mui
 function() {
   // inline contents of mui-email-inline.css into <body>
   return gulp.src('examples/email-inlined/*.html')
     .pipe(inlineCss({
       applyStyleTags: false,
       removeStyleTags: false
     }))
     .pipe(gulp.dest('examples/email-inlined/'));
 }
示例#4
0
gulp.task('inky', ['styles'], function() {
  return gulp.src('./templates/**/*.html')
    .pipe(inlinesource())
    .pipe(inky())
    .pipe(inlineCss({
        preserveMediaQueries: true,
        removeLinkTags: false
    }))
    .pipe(gulp.dest('./dist'));
});
示例#5
0
gulp.task('styles', function() {
    return gulp.src('./*.html')
        .pipe(inlineCss({
            	applyStyleTags: true,
            	applyLinkTags: true,
            	removeStyleTags: true,
            	removeLinkTags: true
        }))
        .pipe(gulp.dest('build/'));
});
gulp.task('build', () => {
  return gulp.src(['src/email.html'])
          .pipe(errorNotifier())

          .pipe(inky())
          .pipe(inlineCSS())
          .pipe(gulpif(!argv.debug, minify(OPTIONS.HTMLmin)))

          .pipe(gulp.dest('.'))
});
	gulp.task('emailstyle', function() {
	    return gulp.src('./src/email-marketing.html')
	        .pipe(inlineCss({
	            	applyStyleTags: true,
	            	applyLinkTags: true,
	            	removeStyleTags: true,
	            	removeLinkTags: true
	        }))
	        .pipe(gulp.dest('./email'));
	});
示例#8
0
gulp.task('inline', ['styles', 'jade'], function() {
  return gulp.src('tmp/index.html')
    .pipe(inlineSource({
      rootpath: 'tmp'
    }))
    .pipe(inlineCss({
      preserveMediaQueries: true
    }))
    .pipe(gulp.dest('dist/'));
});
示例#9
0
gulp.task('inlinecss', function() {
	return gulp.src($src + '/*.html')
		.pipe(inlineCss(
			{
					applyStyleTags: true,
					applyLinkTags: true,
					removeStyleTags: true,
					removeLinkTags: true
			}))
		.pipe(gulp.dest($build));
});
gulp.task('inlinecss', ['sassInline', 'nunjucks'], function() {
    return gulp.src('build/*.html')
        .pipe(
            inlineCss({
                applyStyleTags: false,
                removeStyleTags: false
            })
            .on('error', gutil.log)
        )
        .pipe(gulp.dest('build/'));
});
gulp.task('inline-css', function () {
    return gulp.src('src/index.html')
        .pipe(inlinecss({
                applyStyleTags: true,
                applyLinkTags: true,
                removeStyleTags: true,
                removeLinkTags: true
        }))
        .pipe(htmlmin({collapseWhitespace: true}))
        .pipe(gulp.dest('./dist'));
});
示例#12
0
gulp.task('build-html', () => gulp.src('src/**/*.html')
          .pipe(htmlmin({ collapseWhitespace: true, removeComments: true}))
          .pipe(inlineCSS({
	    applyStyleTags: false,
	    applyLinkTags: true,
	    removeStyleTags: false,
	    removeLinkTags: true,
            preserveMediaQueries: true,
            removeHtmlSelectors: false
          }))
          .pipe(gulp.dest('build'))
          .pipe(symlink('build/splash.html', {relative: true}))
示例#13
0
gulp.task('build', ['sass'], function() {
    return gulp.src(files.ejs)
    .pipe(plumber())
    .pipe(ejs(ejs_options, {ext:'.html'})
        .on('error', util.log))
    .pipe(gulp.dest(dir.dest))
    .pipe(inline({
        applyWidthAttributes: true,
        applyTableAttributes: true, // border, cellpadding and cellspacing
        removeHtmlSelectors: true
    }))
    .pipe(gulp.dest(dir.dest));
});
gulp.task('transform', function() {
	gulp.src(['./src/*.html'])
		.pipe(inlineCss({
			removeHtmlSelectors: true
		}))
		.pipe(htmlmin({
			collapseWhitespace: true,
			minifyCSS: true
		}))
		.pipe(rename({ suffix: '-out' }))
		.pipe(gulp.dest('./out/'))
		.on('end', function() { reload() });
});
示例#15
0
gulp.task('config:files', function() {
    gulp.src('./web/src/config/Email Templates/*')
        .pipe(inlineCss({
            applyStyleTags: true,
            applyLinkTags: true,
            removeStyleTags: false,
            removeLinkTags: false
        }))
        .pipe(removeHtmlComments())
        .pipe(gulp.dest('./build/ConfigurationFiles/Email Templates/'));

    gulp.src('./web/src/config/MIWT Templates/**')
        .pipe(gulp.dest('./build/ConfigurationFiles/MIWT Templates/'));
});
  return function() {
    console.log('---------- Inlining ' + config.instance + ' styles...');

    var stream = gulp.src(config.src)
      .pipe(inlineCSS({
        preserveMediaQueries: false,
        applyStyleTags: true,
        applyLinkTags: true,
        removeStyleTags: false,
        removeLinkTags: false
      }))
      .pipe(gulp.dest(config.dest));

    return stream;
  };
示例#17
0
	gulp.task('inject', ['styles'], function () {
	var injectStyles = gulp.src([
		options.tmp + '/serve/{styles,components}/**/*.css',
		'!' + options.tmp + '/serve/styles/vendor.css'
	], { read: false });


	var injectOptions = {
		ignorePath: [options.src, options.tmp + '/serve'],
		addRootSlash: false
	};

	var wiredepOptions = {
		directory: 'bower_components',
		exclude: [/jquery/]
	};

	return gulp.src(options.src + '/*.html')
		.pipe(fileinclude({
			prefix: '@@',
			basepath: '@file'
		}))
		.pipe($.inject(injectStyles, injectOptions))
		.pipe(wiredep(wiredepOptions))
		.pipe(gulp.dest(options.tmp + '/serve'))
		.pipe(inlineCss({
				applyStyleTags: true,
				applyLinkTags: true,
				removeStyleTags: true,
				removeLinkTags: true
		}))
		.pipe(through.obj(function (file, enc, callback){
			var $ = cheerio.load(file.contents.toString(),{
	            decodeEntities: false
	        });
			$('.email-template *[class],.email-template *[id]').each(function(ind,e){
				if($(e).attr('class')) $(e).removeAttr('class');
				if($(e).attr('id')) $(e).removeAttr('id');
			});

			file.contents = new Buffer($.html());
			callback(null,file);
		}))
		.pipe(gulp.dest(options.tmp + '/serve'));
	});
示例#18
0
gulp.task('email', function() {
	return gulp.src(path.src)
	.pipe( inlineCss(options.inlineCss) )
	.pipe( cheerio({
		run: function ($, file) {
			$(options.remove.el).each(function() {
				var _el = $(this);
				options.remove.attrs.forEach(function(item, index) {
					_el.removeAttr(item);
				});
			})
		},
		parserOptions: {
			// UTF-8 언어 인코딩 설정 부분 (한국어,일어,중국어 등)
			decodeEntities: false
		}
	}) )
	.pipe( gulp.dest(path.out) );
});
gulp.task('html', () => {
  return gulp.src('app/*.html')
    .pipe($.useref({searchPath: ['app', '.']}))
    .pipe(inlineCss({removeStyleTags: false}))
    .pipe(gulp.dest('dist'));
});
gulp.task('html', function() {
	return gulp.src('*.html')
	.pipe(htmlmin({collapseWhitespace: true}))
	.pipe(inlinecss())
	.pipe(gulp.dest('dist'));
});
示例#21
0
gulp.task('inlineCss', ['sass'], function() {
  return gulp.src(['./src/*.html', './dist/*.css'])
    .pipe(inlineCss())
    .pipe(gulp.dest('./'))
    .pipe(browserSync.reload({stream:true}));
});
gulp.task('inline-css', function() {
    return gulp.src('./code.html')
        .pipe(inlineCss())
        .pipe(gulp.dest('./dist'));
});
示例#23
0
var gulp = require('gulp'),
    inlineCss = require('gulp-inline-css');

var args = process.argv.slice(2),
    htmlPath = args[0] || false,
    outputPath = args[1] || false

function callback(err) {
    if(err) {
        console.log('err');
    } else {
        console.log('end');
    }
}

if(htmlPath && outputPath) {
    gulp.src(htmlPath)
        .pipe(inlineCss({
            applyStyleTags: true,
            applyLinkTags: true,
            removeStyleTags: true,
            removeLinkTags: true
        }))
        .pipe(gulp.dest(outputPath))
        .on('end', function() {
            callback(null);
        })
        .on('error', function (err) {
            callback(err);
        });
}
示例#24
0
gulp.task('inline', ['sass', 'haml'], function() {
  return gulp.src(['build/*.html'])
		.pipe(inlineCss())
    .pipe(gulp.dest('build/.'));
});
gulp.task('inlineCss', function() {
    return gulp.src('views/pizza.html')
        .pipe(inlineCss())
        .pipe(gulp.dest('build/'));
});
gulp.task('default', function() {
  return gulp.src("./raw/*html")
        .pipe(inlineCSS())
        .pipe(gulp.dest("./"));
});
gulp.task('inlineCss', function(cb){
	return gulp.src('./*.html')
	.pipe(inlineCss())
	.pipe(gulp.dest('dist/'));
	cb(err);
});
示例#28
0
gulp.task('config', function(cb) {
    runSequence('config:clean', ['config:build'], cb);
    inlineCss('config:clean', ['config:build'], cb);
});
示例#29
0
	gulp.task('build-dist-errorpage', ['less_error'], function(){
		// Needs to be reviewed
		return gulp.src(paths.app + '404.html')
			.pipe(inlineCss())
			.pipe(gulp.dest(paths.dist));
	});
示例#30
0
gulp.task('config:build', function(cb) {
    runSequence('config:files', cb);
    inlineCss('config:files', cb);
});