gulp-html-postcss
Advanced tools
Comparing version 7.0.1 to 7.0.2
'use strict'; | ||
const syntax = require('postcss-html'); | ||
const postcssLoadConfig = require('postcss-load-config'); | ||
@@ -11,5 +10,2 @@ const loadOptions = require('postcss-load-options/lib/options.js'); | ||
const options = config.options || {}; | ||
if (!(options.syntax || options.stringifier || options.parser)) { | ||
options.syntax = syntax; | ||
} | ||
options.map = map; | ||
@@ -25,3 +21,2 @@ config.options = options; | ||
cwd: file.cwd, | ||
syntax: syntax, | ||
map: map, | ||
@@ -54,2 +49,3 @@ }; | ||
}); | ||
return Promise.resolve(config); | ||
@@ -56,0 +52,0 @@ } |
@@ -6,2 +6,3 @@ 'use strict'; | ||
const loadConfig = require('./loadConfig'); | ||
const autoSyntax = require('postcss-html'); | ||
@@ -29,3 +30,51 @@ function process(buffer, file, config) { | ||
return loadConfig(file, config).then(function (config) { | ||
return postcss(config.plugins).process(buffer, config.options); | ||
const syntax = autoSyntax(config.options.syntax); | ||
const document = syntax.parse(buffer, Object.assign({}, config.options)); | ||
if (document.source.syntax) { | ||
return postcss( | ||
config.plugins | ||
).process( | ||
document, | ||
Object.assign( | ||
{ | ||
syntax: document.source.syntax, | ||
}, | ||
config.options | ||
) | ||
); | ||
} else if (document.nodes.length) { | ||
return Promise.all( | ||
document.nodes.map(function(root) { | ||
return postcss( | ||
config.plugins | ||
).process( | ||
root, | ||
config.options | ||
); | ||
}) | ||
).then(function(results) { | ||
const messages = results.reduce(function(messages, result) { | ||
return messages.concat(result.messages); | ||
}, []); | ||
const lastResult = results.pop(); | ||
return Object.assign( | ||
new lastResult.constructor(lastResult.processor, document, lastResult.opts), | ||
{ | ||
lastPlugin: lastResult.lastPlugin, | ||
css: document.toString(syntax), | ||
messages: messages, | ||
} | ||
); | ||
}); | ||
} else { | ||
return document.toResult( | ||
Object.assign( | ||
{}, | ||
config.options, | ||
{ | ||
syntax: syntax, | ||
} | ||
) | ||
); | ||
} | ||
}).then(handleResult, handleError); | ||
@@ -32,0 +81,0 @@ } |
@@ -16,3 +16,3 @@ { | ||
}, | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"description": "Process inline CSS in HTML using PostCSS gulp plugin", | ||
@@ -49,3 +49,3 @@ "main": "lib/index.js", | ||
"gulp-util": "^3.0.8", | ||
"postcss-html": "^0.8.0", | ||
"postcss-html": "^0.11.0", | ||
"postcss-load-config": "^1.2.0", | ||
@@ -60,14 +60,14 @@ "postcss-load-options": "^1.2.0", | ||
"devDependencies": { | ||
"coveralls": "^2.13.1", | ||
"eslint": "^4.2.0", | ||
"coveralls": "^3.0.0", | ||
"eslint": "^4.11.0", | ||
"from2-array": "0.0.4", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sourcemaps": "^2.6.0", | ||
"mocha": "^3.4.2", | ||
"nyc": "^11.0.3", | ||
"postcss": "^6.0.6", | ||
"postcss-less": "^1.1.0", | ||
"gulp-sourcemaps": "^2.6.1", | ||
"mocha": "^4.0.1", | ||
"nyc": "^11.3.0", | ||
"postcss": "^6.0.14", | ||
"postcss-less": "^1.1.3", | ||
"proxyquire": "^1.8.0", | ||
"sinon": "^2.3.7" | ||
"sinon": "^4.1.2" | ||
} | ||
} |
@@ -23,3 +23,3 @@ # gulp-html-postcss | ||
```js | ||
const postcss = require('gulp-postcss'); | ||
const postcss = require('gulp-html-postcss'); | ||
const gulp = require('gulp'); | ||
@@ -26,0 +26,0 @@ |
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
10553
165
0
+ Addedpostcss-html@0.11.0(transitive)
+ Addedpostcss-safe-parser@7.0.0(transitive)
+ Addedremark@8.0.0(transitive)
+ Addedremark-parse@4.0.0(transitive)
+ Addedremark-stringify@4.0.0(transitive)
- Removedhas@1.0.4(transitive)
- Removedpostcss-html@0.8.0(transitive)
- Removedremark@7.0.1(transitive)
- Removedremark-parse@3.0.1(transitive)
- Removedremark-stringify@3.0.1(transitive)
Updatedpostcss-html@^0.11.0