@zougt/vite-plugin-theme-preprocessor
Version:
css theme preprocessor plugin for vite
41 lines (39 loc) • 1.25 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createSetCustomTheme = createSetCustomTheme;
exports.default = void 0;
var _someLoaderUtils = require("@zougt/some-loader-utils");
// import pack from "../../package.json";
function createSetCustomTheme(options) {
const {
styleTagId,
defaultPrimaryColor,
customThemeOutputPath,
includeStyleWithColors,
buildCommand,
cacheThemeStyleContent
} = options;
return (0, _someLoaderUtils.getThemeStyleContent)().then(({
styleContent,
themeRuleValues
}) => {
if (!cacheThemeStyleContent || cacheThemeStyleContent !== styleContent) {
return (0, _someLoaderUtils.createSetCustomThemeFile)({
defaultPrimaryColor,
customThemeOutputPath,
styleTagId,
includeStyleWithColors,
styleContent,
themeRuleValues,
importUtils: buildCommand !== "build",
appendedContent: buildCommand === "build" ? "" : "\nexport default setCustomTheme;",
preAppendedContent: "/**This file created by @zougt/vite-plugin-theme-preprocessor,you can not modify it.*/\n"
});
}
return Promise.resolve();
});
}
var _default = createSetCustomTheme;
exports.default = _default;