gulp-html-postcss
Advanced tools
Comparing version 7.0.5 to 7.1.0
'use strict'; | ||
const syntax = require('postcss-syntax'); | ||
const postcssLoadConfig = require('postcss-load-config'); | ||
@@ -10,2 +11,5 @@ 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; | ||
@@ -21,2 +25,3 @@ config.options = options; | ||
cwd: file.cwd, | ||
syntax: syntax, | ||
map: map, | ||
@@ -23,0 +28,0 @@ }; |
@@ -6,3 +6,2 @@ 'use strict'; | ||
const loadConfig = require('./loadConfig'); | ||
const autoSyntax = require('postcss-html'); | ||
@@ -30,51 +29,3 @@ function process (buffer, file, config) { | ||
return loadConfig(file, config).then((config) => { | ||
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((root) => { | ||
return postcss( | ||
config.plugins | ||
).process( | ||
root, | ||
config.options | ||
); | ||
}) | ||
).then((results) => { | ||
const messages = results.reduce((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(), | ||
messages: messages, | ||
} | ||
); | ||
}); | ||
} else { | ||
return document.toResult( | ||
Object.assign( | ||
{}, | ||
config.options, | ||
{ | ||
syntax: syntax, | ||
} | ||
) | ||
); | ||
} | ||
return postcss(config.plugins).process(buffer, config.options); | ||
}).then(handleResult, handleError); | ||
@@ -81,0 +32,0 @@ } |
@@ -16,3 +16,3 @@ { | ||
}, | ||
"version": "7.0.5", | ||
"version": "7.1.0", | ||
"description": "Process inline CSS in HTML using PostCSS gulp plugin", | ||
@@ -47,8 +47,14 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"bufferstreams": "^1.1.3", | ||
"bufferstreams": "^2.0.1", | ||
"plugin-error": "^1.0.1", | ||
"postcss-html": "^0.17.0", | ||
"postcss-html": "^0.23.6", | ||
"postcss-jsx": "^0.9.0", | ||
"postcss-load-config": "^1.2.0", | ||
"postcss-load-options": "^1.2.0", | ||
"postcss-load-plugins": "^2.3.0", | ||
"postcss-markdown": "^0.23.6", | ||
"postcss-sass": "^0.3.1", | ||
"postcss-scss": "^1.0.5", | ||
"postcss-syntax": "^0.9.0", | ||
"sugarss": "^1.0.1", | ||
"vinyl-sourcemaps-apply": "^0.2.1" | ||
@@ -60,20 +66,20 @@ }, | ||
"devDependencies": { | ||
"coveralls": "^3.0.0", | ||
"coveralls": "^3.0.1", | ||
"eslint": "^4.19.1", | ||
"eslint-config-standard": "^11.0.0", | ||
"eslint-plugin-import": "^2.9.0", | ||
"eslint-plugin-import": "^2.11.0", | ||
"eslint-plugin-node": "^6.0.1", | ||
"eslint-plugin-promise": "^3.7.0", | ||
"eslint-plugin-standard": "^3.0.1", | ||
"eslint-plugin-standard": "^3.1.0", | ||
"from2-array": "0.0.4", | ||
"gulp-rename": "^1.2.2", | ||
"gulp-sourcemaps": "^2.6.4", | ||
"mocha": "^5.0.5", | ||
"nyc": "^11.6.0", | ||
"postcss": "^6.0.21", | ||
"mocha": "^5.1.1", | ||
"nyc": "^11.7.2", | ||
"postcss": "^6.0.22", | ||
"postcss-less": "^1.1.5", | ||
"proxyquire": "^2.0.1", | ||
"sinon": "^4.4.8", | ||
"sinon": "^5.0.7", | ||
"vinyl": "^2.1.0" | ||
} | ||
} |
@@ -7,5 +7,8 @@ # gulp-html-postcss | ||
[PostCSS](https://github.com/postcss/postcss) gulp plugin to pipe inline CSS in HTML within the `<style>` tags through | ||
several plugins, but parse CSS only once. | ||
[PostCSS](https://github.com/postcss/postcss) gulp plugin with support for HTML and HTML-like: | ||
- [JSX](https://reactjs.org/docs/introducing-jsx.html) | ||
- [Vue component](https://vue-loader.vuejs.org/) | ||
- [Quick App](https://doc.quickapp.cn/framework/source-file.html) | ||
- [Markdown](https://daringfireball.net/projects/markdown/syntax) | ||
## Install | ||
@@ -12,0 +15,0 @@ |
74
9408
14
123
+ Addedpostcss-jsx@^0.9.0
+ Addedpostcss-markdown@^0.23.6
+ Addedpostcss-sass@^0.3.1
+ Addedpostcss-scss@^1.0.5
+ Addedpostcss-syntax@^0.9.0
+ Addedsugarss@^1.0.1
+ Addedbufferstreams@2.0.1(transitive)
+ Addedpicocolors@0.2.1(transitive)
+ Addedpostcss@6.0.237.0.39(transitive)
+ Addedpostcss-html@0.23.7(transitive)
+ Addedpostcss-jsx@0.9.0(transitive)
+ Addedpostcss-markdown@0.23.7(transitive)
+ Addedpostcss-sass@0.3.5(transitive)
+ Addedpostcss-scss@1.0.6(transitive)
+ Addedpostcss-styled@0.9.0(transitive)
+ Addedpostcss-syntax@0.10.00.9.1(transitive)
+ Addedsource-map@0.6.1(transitive)
+ Addedsugarss@1.0.1(transitive)
- Removed@ampproject/remapping@2.3.0(transitive)
- Removed@babel/compat-data@7.24.7(transitive)
- Removed@babel/core@7.24.7(transitive)
- Removed@babel/helper-compilation-targets@7.24.7(transitive)
- Removed@babel/helper-module-imports@7.24.7(transitive)
- Removed@babel/helper-module-transforms@7.24.7(transitive)
- Removed@babel/helper-simple-access@7.24.7(transitive)
- Removed@babel/helper-validator-option@7.24.7(transitive)
- Removed@babel/helpers@7.24.7(transitive)
- Removedbrowserslist@4.23.1(transitive)
- Removedbufferstreams@1.1.3(transitive)
- Removedcaniuse-lite@1.0.30001632(transitive)
- Removedconvert-source-map@2.0.0(transitive)
- Removedelectron-to-chromium@1.4.799(transitive)
- Removedescalade@3.1.2(transitive)
- Removedgensync@1.0.0-beta.2(transitive)
- Removedjson5@2.2.3(transitive)
- Removedlru-cache@5.1.1(transitive)
- Removednode-releases@2.0.14(transitive)
- Removedpostcss-html@0.17.0(transitive)
- Removedpostcss-less@6.0.0(transitive)
- Removedpostcss-safe-parser@7.0.0(transitive)
- Removedpostcss-sass@0.5.0(transitive)
- Removedpostcss-scss@4.0.9(transitive)
- Removedsemver@6.3.1(transitive)
- Removedsugarss@4.0.1(transitive)
- Removedupdate-browserslist-db@1.0.16(transitive)
- Removedyallist@3.1.1(transitive)
Updatedbufferstreams@^2.0.1
Updatedpostcss-html@^0.23.6