Sha256: 1822894f216c9be33916ea8b6211bea3e56f98e3bccbca70bc25b9438aa933a3

Contents?: true

Size: 683 Bytes

Versions: 24

Compression:

Stored size: 683 Bytes

Contents

"use strict";

const parseStyle = require("./parse-style");

function getSyntax (config, syntax) {
	if (typeof syntax !== "string") {
		return syntax;
	}
	let syntaxConfig = config[syntax];

	if (syntaxConfig) {
		syntaxConfig = getSyntax(config, syntaxConfig);
	} else {
		syntaxConfig = {
			extract: require(syntax.toLowerCase().replace(/^(postcss-)?/i, "postcss-") + "/extract"),
		};
		config[syntax] = syntaxConfig;
	}

	return syntaxConfig;
}

function processor (source, lang, opts) {
	const syntax = getSyntax(opts.syntax.config, lang);
	const styles = (syntax.extract || syntax)(source, opts) || [];
	return parseStyle(source, opts, styles);
}

module.exports = processor;

Version data entries

24 entries across 24 versions & 1 rubygems

Version Path
trusty-cms-6.3.1 node_modules/postcss-syntax/processor.js
trusty-cms-5.0.7 node_modules/postcss-syntax/processor.js
trusty-cms-5.0.6 node_modules/postcss-syntax/processor.js
trusty-cms-5.0.5 node_modules/postcss-syntax/processor.js
trusty-cms-5.0.4 node_modules/postcss-syntax/processor.js
trusty-cms-5.0.3 node_modules/postcss-syntax/processor.js
trusty-cms-5.0.2 node_modules/postcss-syntax/processor.js
trusty-cms-5.0.1 node_modules/postcss-syntax/processor.js
trusty-cms-4.3.5 node_modules/postcss-syntax/processor.js
trusty-cms-5.0.0 node_modules/postcss-syntax/processor.js
trusty-cms-4.3.4 node_modules/postcss-syntax/processor.js
trusty-cms-4.3.3 node_modules/postcss-syntax/processor.js
trusty-cms-4.3.2 node_modules/postcss-syntax/processor.js
trusty-cms-4.3.1 node_modules/postcss-syntax/processor.js
trusty-cms-4.3 node_modules/postcss-syntax/processor.js
trusty-cms-4.2.3 node_modules/postcss-syntax/processor.js
trusty-cms-4.2.2 node_modules/postcss-syntax/processor.js
trusty-cms-4.2.1 node_modules/postcss-syntax/processor.js
trusty-cms-4.2 node_modules/postcss-syntax/processor.js
trusty-cms-4.1.9 node_modules/postcss-syntax/processor.js