You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
972 B
27 lines
972 B
3 years ago
|
"use strict";
|
||
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||
|
const qs = require("querystring");
|
||
|
const compiler_sfc_1 = require("vue/compiler-sfc");
|
||
|
// This is a post loader that handles scoped CSS transforms.
|
||
|
// Injected right before css-loader by the global pitcher (../pitch.js)
|
||
|
// for any <style scoped> selection requests initiated from within vue files.
|
||
|
const StylePostLoader = function (source, inMap) {
|
||
|
const query = qs.parse(this.resourceQuery.slice(1));
|
||
|
const { code, map, errors } = (0, compiler_sfc_1.compileStyle)({
|
||
|
source: source,
|
||
|
filename: this.resourcePath,
|
||
|
id: `data-v-${query.id}`,
|
||
|
map: inMap,
|
||
|
scoped: !!query.scoped,
|
||
|
trim: true,
|
||
|
isProd: this.mode === 'production' || process.env.NODE_ENV === 'production',
|
||
|
});
|
||
|
if (errors.length) {
|
||
|
this.callback(errors[0]);
|
||
|
}
|
||
|
else {
|
||
|
this.callback(null, code, map);
|
||
|
}
|
||
|
};
|
||
|
exports.default = StylePostLoader;
|