jxt-react-library
Advanced tools
| .container { | ||
| background-color: red; | ||
| } | ||
| .container .content { | ||
| color: green; | ||
| } |
+4
-34
@@ -11,40 +11,10 @@ 'use strict'; | ||
| function styleInject(css, ref) { | ||
| if (ref === void 0) ref = {}; | ||
| var insertAt = ref.insertAt; | ||
| if (!css || typeof document === 'undefined') { | ||
| return; | ||
| } | ||
| var head = document.head || document.getElementsByTagName('head')[0]; | ||
| var style = document.createElement('style'); | ||
| style.type = 'text/css'; | ||
| if (insertAt === 'top') { | ||
| if (head.firstChild) { | ||
| head.insertBefore(style, head.firstChild); | ||
| } else { | ||
| head.appendChild(style); | ||
| } | ||
| } else { | ||
| head.appendChild(style); | ||
| } | ||
| if (style.styleSheet) { | ||
| style.styleSheet.cssText = css; | ||
| } else { | ||
| style.appendChild(document.createTextNode(css)); | ||
| } | ||
| } | ||
| var css_248z = ".container {\n color: red;\n}"; | ||
| styleInject(css_248z); | ||
| function Switch() { | ||
| return /*#__PURE__*/React__default["default"].createElement("h1", { | ||
| return /*#__PURE__*/React__default["default"].createElement("div", { | ||
| className: "container" | ||
| }, "Switch"); | ||
| }, /*#__PURE__*/React__default["default"].createElement("h1", { | ||
| className: "content" | ||
| }, "Switch")); | ||
| } | ||
| exports.Switch = Switch; |
+3
-1
| { | ||
| "name": "jxt-react-library", | ||
| "version": "1.0.4", | ||
| "version": "1.0.5", | ||
| "main": "lib/bundle.js", | ||
@@ -19,7 +19,9 @@ "author": "gengyudongzzu", | ||
| "@babel/preset-react": "^7.14.5", | ||
| "less": "^4.1.2", | ||
| "postcss": "^8.3.11", | ||
| "rollup": "^2.58.0", | ||
| "rollup-plugin-babel": "^4.4.0", | ||
| "rollup-plugin-less": "^1.1.3", | ||
| "rollup-plugin-postcss": "^4.0.1" | ||
| } | ||
| } |
+52
-10
@@ -1,12 +0,54 @@ | ||
| import babel from 'rollup-plugin-babel'; | ||
| import postcss from 'rollup-plugin-postcss'; | ||
| import babel from "rollup-plugin-babel"; | ||
| // import less from "rollup-plugin-less"; | ||
| const postcss = require('rollup-plugin-postcss'); | ||
| const less = require('less'); | ||
| const processLess = function (context, payload) { | ||
| return new Promise((resolve, reject) => { | ||
| less.render( | ||
| { | ||
| file: context, | ||
| }, | ||
| function (err, result) { | ||
| if (!err) { | ||
| resolve(result); | ||
| } else { | ||
| reject(err); | ||
| } | ||
| } | ||
| ); | ||
| less.render(context, {}).then( | ||
| function (output) { | ||
| // output.css = string of css | ||
| // output.map = string of sourcemap | ||
| // output.imports = array of string filenames of the imports referenced | ||
| if (output && output.css) { | ||
| resolve(output.css); | ||
| } else { | ||
| reject({}); | ||
| } | ||
| }, | ||
| function (err) { | ||
| reject(err); | ||
| } | ||
| ); | ||
| }); | ||
| }; | ||
| export default { | ||
| input: './src/index.js', | ||
| output: { | ||
| file: './lib/bundle.js', | ||
| format: 'cjs' | ||
| }, | ||
| plugins: [babel(), postcss()], | ||
| external: ['react'] | ||
| } | ||
| input: "./src/index.js", | ||
| output: { | ||
| file: "./lib/bundle.js", | ||
| format: "cjs", | ||
| }, | ||
| plugins: [ | ||
| babel(), | ||
| postcss({ | ||
| extract: true, | ||
| // minimize: isProductionEnv, | ||
| process: processLess, | ||
| }), | ||
| ], | ||
| external: ["react"], | ||
| }; |
2778
31.16%7
16.67%70
48.94%9
28.57%