Răsfoiți Sursa

chore: backup

DaiQiangReal 3 ani în urmă
părinte
comite
b1c96f6779

+ 82 - 0
packages/semi-scss-to-css-var/README.md

@@ -0,0 +1,82 @@
+> A Scss compile tool for Semi Design
+
+## Description
+
+There are mainly the following two usage scenarios:
+
+- For Sever side consumption in Semi Design System.When publishing the theme, call the script on the Node side to
+  compile the custom theme package into a complete semi.css file
+- Before publish `@douyinfe/semi-foundation`,construct a complete semi.css file
+
+## Usage
+
+### Command Line
+
+```shell
+npm i -g @douyinfe/semi-scss-compile
+
+semi-build-scss --foundation="path/to/foundation" --theme="path/to/theme" --icon="path/to/'@douyinfe/semi-icons'" --output="path/to/output.css" --min
+
+# or for short
+
+semi-build-scss -f "path/to/foundation" -t "path/to/theme" -i "path/to/'@douyinfe/semi-icons'" -o "path/to/output.css" -m
+
+```
+
+### JS API
+
+```js
+
+const {compile} = require('@douyinfe/semi-scss-compile');
+const path = require('path');
+
+function resolve(dir) {
+    return path.join(__dirname, '../..', dir);
+}
+
+//eg
+
+compile({
+    foundationPath:resolve('semi-foundation/'),
+    themePath:resolve('semi-theme-default/'),
+    iconPath: resolve('node_modules/@douyinfe/semi-icons'),
+    outputPath:resolve('semi-ui/dist/css/semi.min.css'),
+    isMin:true
+})
+
+compile({
+    foundationPath:resolve('semi-foundation/'),
+    themePath:resolve('semi-theme-default/'),
+    iconPath: resolve('node_modules/@douyinfe/semi-icons'),
+    outputPath:resolve('semi-ui/dist/css/semi.css'),
+    isMin:false
+})
+```
+
+### Advanced API
+
+```js
+const {generateScssMap, writeFile, compilerFromScssMap} = require('@douyinfe/semi-scss-compile');
+const fs = require('fs-extra');
+
+const isMin = false;
+const scssMap = generateScssMap("path/to/foundation", "path/to/theme","path/to/'@douyinfe/semi-icons'");
+const tempDir = writeFile(scssMap)
+const result = compilerFromScssMap(path.join(tempDir, 'index.scss'), isMin);
+fs.outputFileSync(outputPath, result.css);
+
+```
+
+## Maintainers
+
+<table>
+    <tbody>
+        <tr>
+            <td align="center"><a href="https://github.com/DouyinFE/semi-design"><img src="https://sf6-cdn-tos.douyinstatic.com/obj/eden-cn/ptlz_zlp/ljhwZthlaukjlkulzlp/SemiLogo.jpg" width="100px;" alt="" style="max-width:100%;"><br><sub><b>Semi Teams</b></sub></a></td>
+        </tr>
+    </tbody>
+</table>
+
+## License
+
+MIT

+ 39 - 0
packages/semi-scss-to-css-var/package.json

@@ -0,0 +1,39 @@
+{
+  "name": "@douyinfe/semi-scss-to-css-var",
+  "version": "2.5.0",
+  "description": "Transform semi scss variables to css variables for dsm",
+  "author": "[email protected]",
+  "license": "MIT",
+  "main": "lib/index.js",
+  "types": "lib/index.d.ts",
+  "bin": {
+    "semi-scss-to-css-var": "lib/bin.js"
+  },
+  "files": [
+    "lib",
+    "src"
+  ],
+  "keywords": [
+    "semi-scss-to-css-var",
+    "scss",
+    "scss variables",
+    "css variables",
+    "design system"
+  ],
+  "scripts": {
+    "start": "ts-node",
+    "build:lib": "rimraf lib && tsc",
+    "prepublishOnly": "npm run build:lib"
+  },
+  "dependencies": {
+    "arg": "^5.0.1",
+    "fs-extra": "^8.1.0",
+    "lodash": "^4.17.21",
+    "sass": "^1.45.0"
+  },
+  "devDependencies": {
+    "@types/lodash": "^4.14.176",
+    "rimraf": "^3.0.2",
+    "typescript": "^4.4.4"
+  }
+}

+ 10 - 0
packages/semi-scss-to-css-var/src/bin.ts

@@ -0,0 +1,10 @@
+#!/usr/bin/env node
+
+import arg from 'arg';
+import { transScssVariables2CssVariables } from './index';
+
+const main = () => {
+    console.log('bin exec');
+};
+
+main();

+ 17 - 0
packages/semi-scss-to-css-var/src/index.ts

@@ -0,0 +1,17 @@
+import path from 'path';
+import fs from 'fs-extra';
+
+
+export interface Options {
+    path:string
+}
+
+const transScssVariables2CssVariables = ({path}: Options) => {
+    console.log(path);
+};
+
+
+export {
+    transScssVariables2CssVariables
+};
+

+ 17 - 0
packages/semi-scss-to-css-var/tsconfig.json

@@ -0,0 +1,17 @@
+{
+  "compilerOptions": {
+    "sourceMap": true,
+    "strict": true,
+    "target": "ES2017",
+    "module": "commonjs",
+    "esModuleInterop":true,
+    "moduleResolution": "Node",
+    "declaration": true,
+    "outDir": "./lib",
+    "rootDir": "./src",
+    "types": []
+  },
+  "include": [
+    "src/**/*"
+  ]
+}