-
Notifications
You must be signed in to change notification settings - Fork 267
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5b560c5
commit 98ff201
Showing
10 changed files
with
538 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 6 additions & 0 deletions
6
packages/nutui-optimize-css/test/__snapshots__/remove-rtl.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`@nutui/optimize-css > remove rtl 1`] = ` | ||
" | ||
" | ||
`; |
15 changes: 15 additions & 0 deletions
15
packages/nutui-optimize-css/test/__snapshots__/replace-css-var.test.ts.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html | ||
|
||
exports[`@nutui/optimize-css > optimize css 1`] = ` | ||
":root { | ||
--nutui-color-primary-text: blue; | ||
} | ||
.nut-address-footer-btn { | ||
background: linear-gradient(135deg, yellow 0%, #fa2c19 100%); | ||
color: blue; | ||
color: var(--nutui-color-primary-text) | ||
} | ||
" | ||
`; |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import postcss from 'postcss' | ||
import { describe, expect, it } from 'vitest' | ||
import optimizeCss from '../dist/index.cjs' | ||
|
||
const css = ` | ||
[dir=rtl] .ca, .xcdd { | ||
margin-left: 0; | ||
margin-right: 9px | ||
} | ||
[dir=rtl] .nut-address-exist-item-info, .nut-rtl .nut-address-exist-item-info { | ||
margin-left: 0; | ||
margin-right: 9px | ||
} | ||
` | ||
describe('@nutui/optimize-css', () => { | ||
it('remove rtl', async () => { | ||
const a = await postcss([ | ||
optimizeCss({ | ||
removeRtl: true, | ||
}), | ||
]).process(css, { from: undefined }) | ||
const optimizedCsss = a.css.toString() | ||
// @ts-ignore | ||
expect(optimizedCsss).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import postcss from 'postcss' | ||
import path from 'path' | ||
import { describe, expect, it } from 'vitest' | ||
import optimizeCss from '../dist/index.cjs' | ||
|
||
const css = ` | ||
.nut-address-footer-btn { | ||
background: linear-gradient(135deg, var(--nutui-color-primary-stop-1, #f53d6d) 0%, var(--nutui-color-primary-stop-2, #fa2c19) 100%); | ||
color: var(--nutui-color-primary-text) | ||
} | ||
` | ||
describe('@nutui/optimize-css', () => { | ||
it('optimize css', async () => { | ||
const a = await postcss([ | ||
optimizeCss({ | ||
cssVariables: { | ||
include: [path.join(__dirname, 'variables.scss')], | ||
exclude: ['--nutui-color-primary-text'], | ||
type: 'replace', | ||
}, | ||
}), | ||
]).process(css, { from: undefined }) | ||
const optimizedCsss = a.css.toString() | ||
console.log(optimizedCsss) | ||
// @ts-ignore | ||
expect(optimizedCsss).toMatchSnapshot() | ||
}) | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
{ | ||
"extends": "../../tsconfig.json", | ||
"compilerOptions": { | ||
"allowSyntheticDefaultImports": true, | ||
"experimentalDecorators": true, | ||
"moduleResolution": "node", | ||
"noImplicitAny": false, | ||
"noUnusedLocals": true, | ||
"noUnusedParameters": true, | ||
"removeComments": false, | ||
"resolveJsonModule": true, | ||
"skipLibCheck": true, | ||
"strictNullChecks": true, | ||
"target": "ES2015", | ||
"outDir": "./dist", | ||
"rootDir": "./src", | ||
"module": "ESNext", | ||
"sourceMap": true, | ||
"declaration": true, | ||
"declarationDir": "types", | ||
"isolatedModules": false, | ||
"types": ["node"] | ||
}, | ||
"include": [ | ||
"./src" | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { defineConfig } from 'vitest/config' | ||
|
||
export default defineConfig({ | ||
test: { | ||
// ... Specify options here. | ||
}, | ||
}) |
Oops, something went wrong.