transitive-bullshit / create-react-library

CLI for creating reusable react libraries.
https://transitivebullsh.it/javascript-dev-tools-in-2022
4.78k stars 300 forks source link

implementing scss in create-react-library #259

Open rei27jangao opened 4 years ago

rei27jangao commented 4 years ago

Hi guys, im trying to implement scss in create-react-library.

`import css from 'rollup-plugin-css-only'

export default { entry: 'entry.js', dest: 'bundle.js', plugins: [css({ output: 'bundle.css' })] }`

this is my rollup.config.js under src/ folder, the problem is it still not working, I also added node-sass but still not working

FinnONeill commented 4 years ago

I was able to get sass working by disabling css-modules and installing node-sass then just editing the root package.json start and build script parameters as below (basically just added --css-modules false to the microbundle-crl):

"scripts": {
    "build": "microbundle-crl --no-compress --css-modules false --format modern,cjs",
    "start": "microbundle-crl watch --no-compress --css-modules false --format modern,cjs",
    "prepare": "run-s build",
    "test": "run-s test:unit test:lint test:build",
    "test:build": "run-s build",
    "test:lint": "eslint .",
    "test:unit": "cross-env CI=1 react-scripts test --env=jsdom",
    "test:watch": "react-scripts test --env=jsdom",
    "predeploy": "cd example && npm install && npm run build",
    "deploy": "gh-pages -d example/build"
  },