Skip to content

Commit

Permalink
refactor: add global scss
Browse files Browse the repository at this point in the history
  • Loading branch information
oasis-cloud committed Nov 27, 2024
1 parent 9332996 commit 08923e5
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 22 deletions.
2 changes: 2 additions & 0 deletions packages/nutui-taro-demo/src/app.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../../src/styles/jd-font.scss';

body {
font-size: 14px;
}
Expand Down
19 changes: 8 additions & 11 deletions scripts/build-taro.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -237,22 +237,19 @@ async function copyStyles() {
resolve(__dirname, '../dist/styles'),
)

const content = [
let content = [
`@import '../theme-default.scss';`,
`@import '../variables.scss';`,
`@import '../mixins/index.scss';`,
`@import '../animation/index.scss';`,
`@import '../theme-dark.scss';`,
`@import '../font-face.scss';`,
]
const projectID = process.env.VITE_APP_PROJECT_ID
if (projectID) {
content[1] = `@import '../variables-${projectID}.scss';`
content = [
`@import '../theme-${projectID}.scss';`,
`@import '../font-face.scss';`,
]
}
const scssFiles = await glob(['dist/es/packages/**/*.scss'])
scssFiles.forEach((file) => {
content.push(
`@import '${relativeFilePath('/dist/styles/themes/default.scss', '/' + file)}';`,
)
})

dest('dist/styles/themes/default.scss', content.join('\n'))
}

Expand Down
19 changes: 8 additions & 11 deletions scripts/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -197,22 +197,19 @@ async function copyStyles() {
resolve(__dirname, '../dist/styles')
)

const content = [
let content = [
`@import '../theme-default.scss';`,
`@import '../variables.scss';`,
`@import '../mixins/index.scss';`,
`@import '../animation/index.scss';`,
`@import '../theme-dark.scss';`,
`@import '../font-face.scss';`,
]
const projectID = process.env.VITE_APP_PROJECT_ID
if (projectID) {
content[1] = `@import '../variables-${projectID}.scss';`
content = [
`@import '../theme-${projectID}.scss';`,
`@import '../font-face.scss';`,
]
}
const scssFiles = await glob(['dist/es/packages/**/*.scss'])
scssFiles.forEach((file) => {
content.push(
`@import '${relativeFilePath('/dist/styles/themes/default.scss', '/' + file)}';`
)
})

dest('dist/styles/themes/default.scss', content.join('\n'))
}

Expand Down
2 changes: 2 additions & 0 deletions src/sites/mobile/App.scss
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
@import '../../styles/jd-font.scss';

html,
body {
&::-webkit-scrollbar {
Expand Down

0 comments on commit 08923e5

Please sign in to comment.