Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The example "with-external-scoped-css" works randomly #3276

Closed
anacicconi opened this issue Nov 14, 2017 · 6 comments
Closed

The example "with-external-scoped-css" works randomly #3276

anacicconi opened this issue Nov 14, 2017 · 6 comments

Comments

@anacicconi
Copy link

Context

I need to use external sass stylesheets so I decided to follow the "with-external-scoped-css" example. However, the behavior is quite strange. The first time I launch the project it creates a static folder and I have my css working. If I try to make changes and run the project again nothing happens the most part of the time. Sometimes the static folder is re-created but it's really random.

Steps to Reproduce

  1. Go to the "with-external-scoped-css" project

  2. npm install && npm run start

Result: you may have a static folder and the css must work.

  1. change the font-size in the index.sass file

  2. npm run start

Result: nothing happens

  1. try to delete the .next folder and the static folder

  2. start the whole process again (npm install && npm run start)

Result: sometimes the static folder is re-created and sometimes it isn't

Expected Behavior

  1. npm install && npm run start

Result: the static folder should be created and the css should be working

  1. change the font-size in the index.sass file

  2. npm run start

Result: the css changes

Your Environment

Mac OS 10.11.6
node v8.6.0
npm 5.3.0

@stevegeek
Copy link

Yes I have found I need to clear the npm cache ./node_modules/.cache any time I want the CSS to be rebuilt, not really a viable option. Im assuming this is because babel caches things there and wont rebuild the assets most of the time

@adisak1618
Copy link

Yes i think it about the cache but if you change the name of you style in both scss and js it will work fine. Other problem would be how to do hot reload TT

@Kyle-Mendes
Copy link

Kyle-Mendes commented Nov 20, 2017

I was able to get reliable builds when running next with "dev": "rm -rf ./node_modules/.cache/babel-loader && next"

However, this definitely seems to require me to restart next everytime I make a change to stylesheets, which is obviously less than ideal. It'd be great if someone could point me to a reliable solution to ensuring the css file is rebuilt on change.

@sheerun
Copy link
Contributor

sheerun commented Dec 1, 2017

Potential solution: #3364

@etodanik
Copy link

etodanik commented Dec 6, 2017

Getting the same behavior.. Used @Kyle-Mendes solution but it really does require to restart every time styles are changed.

@sheerun
Copy link
Contributor

sheerun commented Dec 13, 2017

The work-around in my case was to put extracted stylesheets in directory outside .next for development in inside .next for production. #3451

@lock lock bot locked as resolved and limited conversation to collaborators Jan 31, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

7 participants