uni-plugin-light
Version:
uni-app相关插件、loader及webpack基础配置
2 lines (1 loc) • 1.44 kB
JavaScript
;Object.defineProperty(exports,"__esModule",{value:!0});var t=require("fs"),e=require("loader-utils");function n(t){if(t&&t.__esModule)return t;var e=Object.create(null);return t&&Object.keys(t).forEach((function(n){if("default"!==n){var r=Object.getOwnPropertyDescriptor(t,n);Object.defineProperty(e,n,r.get?r:{enumerable:!0,get:function(){return t[n]}})}})),e.default=t,Object.freeze(e)}var r=n(t),c="base.scss";function o(t){return r.readdirSync(t).filter((function(t){return t.endsWith("scss")&&!t.startsWith(c)})).map((function(t){return t.replace(/\.scss$/,"")}))}var i="h5",s="ALL";function u(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:[],n=(e.getOptions(this)||{}).platforms,r=void 0===n?t:n,c=process.env.UNI_PLATFORM||"";return r===s||r.indexOf(s)>-1||r.includes(c)}exports.default=function(t){if(!u.call(this,[i]))return t;var n=(e.getOptions(this)||{}).topElement,r=void 0===n?"body":n,c=this.context,s=function(t){var e=t.match(/\/([^/]+)\/css/);return(null==e?void 0:e[1])||""}(c);if(!s)return t;var a=function(t){var e=t.styleList,n=t.componentName,r=t.topElement,c=t.dir,o=void 0===c?"":c,i=e.map((function(t){return"\n &--type-".concat(t," {\n @import './").concat(o).concat(t,".scss';\n }")})).join("\n");return"\n".concat(r,".").concat(n," {\n ").concat(i,"\n}\n")}({styleList:o(c),componentName:s,topElement:r,dir:""});return"".concat(t,"\n").concat(a)},exports.getStyleList=o;