postcss-html
Advanced tools
Comparing version 1.4.0 to 1.4.1
@@ -7,2 +7,3 @@ "use strict"; | ||
const SvelteTokenizer = require("./svelte-tokenizer"); | ||
const { cssSafeSyntax } = require("../syntax/syntaxes"); | ||
@@ -129,2 +130,3 @@ function iterateCode(source, { onStyleTag, onStyleAttribute, svelte }) { | ||
); | ||
const svelte = opts.from && /\.svelte$/i.test(opts.from); | ||
@@ -147,3 +149,7 @@ function onStyleTag(style) { | ||
if (/\{[\s\S]*?\}/.test(style.content)) { | ||
style.syntax = buildTemplateSyntax(resolveSyntax()); | ||
style.syntax = buildTemplateSyntax( | ||
resolveSyntax("css", { | ||
defaultSyntax: svelte ? cssSafeSyntax : undefined, | ||
}) | ||
); | ||
style.lang = "custom-template"; | ||
@@ -160,3 +166,3 @@ } else { | ||
onStyleAttribute, | ||
svelte: opts.from && /\.svelte$/i.test(opts.from), | ||
svelte, | ||
}); | ||
@@ -163,0 +169,0 @@ |
@@ -52,4 +52,5 @@ "use strict"; | ||
return function resolve(baseLang) { | ||
return function resolve(baseLang, baseOptions) { | ||
let lang = baseLang || "css"; | ||
const options = baseOptions || {}; | ||
@@ -70,3 +71,3 @@ const cwd = process.cwd(); | ||
if (typeof syntax === "string") { | ||
const syntaxModule = loadFromString(syntax); | ||
const syntaxModule = loadFromString(syntax, options); | ||
if (syntaxModule) { | ||
@@ -93,3 +94,3 @@ return syntaxModule; | ||
return cssSyntax; | ||
return options.defaultSyntax || cssSyntax; | ||
}; | ||
@@ -111,5 +112,5 @@ }; | ||
function loadFromString(syntax) { | ||
function loadFromString(syntax, options) { | ||
if (syntax === "postcss") { | ||
return cssSyntax; | ||
return options.defaultSyntax || cssSyntax; | ||
} | ||
@@ -116,0 +117,0 @@ if (syntax === "postcss-safe-parser") { |
{ | ||
"name": "postcss-html", | ||
"version": "1.4.0", | ||
"version": "1.4.1", | ||
"publishConfig": { | ||
@@ -5,0 +5,0 @@ "access": "public" |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
26847
721