revelrylabs / sassy-npm-importer

Import SASS from npm via a customizable prefix.
MIT License
18 stars 2 forks source link

React - CRA App #11

Open MrChriZ opened 6 years ago

MrChriZ commented 6 years ago

Is there a way to use this with a react CRA App? I've used this technique https://medium.com/@Connorelsea/using-sass-with-create-react-app-7125d6913760 to use Node-Sass.

prehnRA commented 6 years ago

In theory, yes. I'm not exactly sure how though. We have our own app scaffolding tools and so we don't spend much time with CRA at Revelry. I'd welcome a PR from anyone who wants to try this and can contribute docs to guide others.

gregrickaby commented 4 years ago

👋 It's actually possible to use Harmonium's Sass without sassy-npm-importer.

First, follow the instructions to enable Sass within in Create React App:

Now you can rename src/App.css to src/App.scss and update src/App.js to import src/App.scss. This file and any other file will be automatically compiled if imported with the extension .scss or .sass.

Then, install Harmonium (if you haven't already)

npm i harmonium --save

Next, add the import to your App.scss

@import "~harmonium/scss/app";

Now, kick off CRA w/ HMR:

npm run start

Edit quirky-hypatia-fl1ql

Cheers! 🍻