Skip to content

Commit

Permalink
refactor (#15): Simplify building of SCSS to use rollup, & imports to…
Browse files Browse the repository at this point in the history
… be able to import via index.scss file

See webpack-contrib/sass-loader#535
  • Loading branch information
jackkoppa committed Sep 24, 2020
1 parent 2b7da24 commit c4b558c
Show file tree
Hide file tree
Showing 4 changed files with 146 additions and 1 deletion.
136 changes: 136 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion package.json
Expand Up @@ -11,7 +11,7 @@
"sideEffects": false,
"scripts": {
"test": "echo \"TODO: write basic specs\"",
"build": "NODE_ENV=production rollup --config rollup.config.js && rm -rf dist/styles && cp -r src/styles dist/styles",
"build": "rm -rf dist && NODE_ENV=production rollup --config rollup.config.js",
"prepublishOnly": "npm test && npm run build && npm run shake",
"shake": "agadoo dist/index.js",
"storybook": "start-storybook -p 6006 --docs",
Expand Down Expand Up @@ -52,6 +52,7 @@
"core-js": "^3.6.5",
"react-is": "^16.13.1",
"rollup": "^2.26.11",
"rollup-plugin-copy": "^3.3.0",
"rollup-plugin-typescript2": "^0.27.2",
"rollup-plugin-vue": "^5.1.9",
"sass-loader": "^10.0.2",
Expand Down
7 changes: 7 additions & 0 deletions rollup.config.js
@@ -1,5 +1,6 @@
import typescript from 'rollup-plugin-typescript2'
import VuePlugin from 'rollup-plugin-vue'
import copy from 'rollup-plugin-copy'

import pkg from './package.json'

Expand All @@ -16,6 +17,12 @@ export default {
typescript(),
VuePlugin({
css: false
}),
copy({
// For now, we only support usage of the styling as SCSS mixins, and thus only need to copy over the SCSS without compilation
// In the future, we could easily export compiled CSS by request, & perhaps allow for CSS vars replacing SCSS vars for customization in that case
targets: [{ src: 'src/**/*.scss', dest: 'dist' }],
flatten: false
})
],
};
1 change: 1 addition & 0 deletions src/index.scss
@@ -0,0 +1 @@
@import './styles/mixins.scss';

0 comments on commit c4b558c

Please sign in to comment.