How to use the critical.stream function in critical

To help you get started, we’ve selected a few critical examples, based on popular ways it is used in public projects.

github nmihalyov / gulp-pure-start / gulpfile.js View on Github external
gulp.task('_pug',  () => {
	return gulp.src(`${dev}/pug/*.pug`)
	.pipe(pug({
		pretty: true
	}))
	.pipe(critical({                            // генерируем критический CSS для быстрой загрузки страниц
		base: `${build}/`,                      // из всех наших файлов
		minify: true,                           // с минификацией
		inline: true,
		width: 1920,
		height: 1280,
		css: [`${build}/css/style.min.css`]     // путь к вашему основному файлу стилей, или несколько файлов через звпятую
	}))
	.on('error', notify.onError({
		title: 'PUG',
		message: '<%= error.message %>'
	}))
	.pipe(gulp.dest(`${prod}`));
});
github devspace / devspace / gulpfile.js View on Github external
gulp.task('critical', function () {
  return gulp.src('src/index.html')
    .pipe(gulp.dest('dist'))
    .pipe(critical({
      css: ['dist/styles/main.css'],
      height: 700,
      inline: true,
      minify: true
    }))
    .pipe($.minifyHtml())
    .pipe(gulp.dest('dist'));
});
github thedaviddias / Front-End-Design-Checklist / gulpfile.babel.js View on Github external
langs.forEach(lang => {
    return gulp.src(`${dirs.dest}/index-${lang}.html`)
      .pipe(critical({
        base: 'dist/',
        inline: true,
        css: 'dist/styles/main.min.css',
        minify: true,
        ignore: [/url\(/, '@font-face', /print/]
      }))
      .pipe(htmlmin({
        collapseWhitespace: true,
        removeComments: true
      }))
      .pipe(rename({
        basename: 'index'
      }))
      .pipe(gulpif(lang !== 'en', gulp.dest(`${dirs.dest}/${lang}`), gulp.dest(`${dirs.dest}`)))
  })
});
github Snugug / gulp-armadillo / lib / tasks / critical.js View on Github external
module.exports.compile = () => {
  const base = task.dest('');

  const criticalOpts = config.critical;
  criticalOpts.base = base;

  const minifyOpts = config.htmlmin;

  return combine([
    empty(),
    critical(criticalOpts),
    minify(minifyOpts),
  ]);
};
github canonical-webteam-archive / tour.ubuntu.com / Gulpfile.js View on Github external
gulp.task('critical', function () {
  return gulp.src('en/src/index.html')
      .pipe(critical({base: 'en/src', inline: true, css: ['css/style.min.css']}))
      .pipe(gulp.dest('en/src'));
});
github sp90 / prototype-builder / gulp / copy.js View on Github external
gulp.task('html--deploy', function() {
		return gulp.src(config.html)
			.pipe(critical({
				base: 'dist/',
				inline: true,
				css: ['dist/app.css']
			}))
			.pipe(gulp.dest('dist'));
	});
github meetupjs-ar / meetupjs-ar.github.io / gulp / tasks / html / html-build.js View on Github external
return function() {
        return gulp
            .src(config.src.html)
            .pipe(
                gulpif(
                    config.isProduction,
                    critical({
                        base: '/dist/',
                        css: ['dist/css/main.css'],
                        dimensions: [
                            {
                                height: 480,
                                width: 320
                            },
                            {
                                height: 640,
                                width: 360
                            },
                            {
                                height: 768,
                                width: 1024
                            }
                        ],

critical

Extract & Inline Critical-path CSS from HTML

Apache-2.0
Latest version published 9 days ago

Package Health Score

86 / 100
Full package analysis

Similar packages