Socket
Socket
Sign inDemoInstall

critical

Package Overview
Dependencies
122
Maintainers
1
Versions
109
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.2 to 0.1.3

23

index.js

@@ -100,1 +100,24 @@ /*

/**
* Generate and inline critical-path CSS
* @param {object} opts Options
* @param {function} cb Callback
* @accepts src, base, width, height, styleTarget, htmlTarget
*/
exports.generateInline = function (opts, cb) {
opts = opts || {};
cb = cb || function () {};
if (!opts.styleTarget && !opts.htmlTarget) {
cb(new Error('Valid style and HTML targets are required.'));
return;
}
var genOpts = opts, inlineOpts = opts;
genOpts.dest = opts.styleTarget;
exports.generate(genOpts, function (err, output) {
if (err) cb(err);
inlineOpts.dest = opts.htmlTarget;
exports.inline(inlineOpts);
});
}

2

package.json
{
"name": "critical",
"version": "0.1.2",
"version": "0.1.3",
"description": "Critical-path CSS generation & inlining",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -20,2 +20,16 @@ critical

###Generate and inline critical-path CSS
```js
critical.generateInline({
base: 'dist/',
src: 'index.html',
styleTarget: 'styles/main.css',
htmlTarget: 'index-critical.html',
width: 320,
height: 480,
minify: true
});
```
###Generate critical-path CSS

@@ -129,2 +143,12 @@

####styleTarget
Type: `string`
(generateInline only) Destination for critical-path styles
####htmlTarget
Type: `string`
(generateInline only) Destination for (critical-path CSS) style-inlined HTML
## Why?

@@ -131,0 +155,0 @@

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc