Hi, I follow the step and success to custom my bootsrap.
However in my component folder such as Header.js that it can't listen to Header.sass but Header.css work!!
{
"status": 1,
"file": "/Users/alan2305/F2E/week2/filter-app/src/assets/index.scss",
"line": 2,
"column": 1,
"message": "File to import not found or unreadable: bootstrap/scss/_functions.scss.",
"formatted": "Error: File to import not found or unreadable: bootstrap/scss/_functions.scss.\n on
line 2 of src/assets/index.scss\n>> @import \"bootstrap/scss/_functions.scss\";\n\n \n"
}
It look like npm run eject cause my script crash in package.json !?
This tutorial is actually made for not ejecting if you run eject you cannot update create-react-app on that project to fix it I think you can follow this tutorial.
The scripts are looking for .scss files in /src/styles since you change the folder name to assets now is checking in /src/assets and what the script does is that if you don't add _ at the biginning of the name will treat it as a new file so from a Header.scss it will create a Header.css (the .css is the one file that you can use inside your component, because is a build css file).
IMO you should create a index.scss and then import every component style file (like _header.scss) after importing _custom boostrap and boostrap and then import in the App.js the index.css that the script will generate on every change of any .scss file in the /src/assets folder, but this is just a way to do it I understand that can be more clear to have it in every component folder.
If needed I can take a look if you have a public repo.
Hope it helps.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi, I follow the step and success to custom my bootsrap.
However in my component folder such as Header.js that it can't listen to Header.sass but Header.css work!!
So I npm run eject and add sass loader like this
And then I got error :
{
"status": 1,
"file": "/Users/alan2305/F2E/week2/filter-app/src/assets/index.scss",
"line": 2,
"column": 1,
"message": "File to import not found or unreadable: bootstrap/scss/_functions.scss.",
"formatted": "Error: File to import not found or unreadable: bootstrap/scss/_functions.scss.\n on
line 2 of src/assets/index.scss\n>> @import \"bootstrap/scss/_functions.scss\";\n\n \n"
}
It look like npm run eject cause my script crash in package.json !?
how can I resolve this problem thx!!
This tutorial is actually made for not ejecting if you run
eject
you cannot updatecreate-react-app
on that project to fix it I think you can follow this tutorial.The scripts are looking for
.scss
files in/src/styles
since you change the folder name toassets
now is checking in/src/assets
and what the script does is that if you don't add_
at the biginning of the name will treat it as a new file so from aHeader.scss
it will create aHeader.css
(the.css
is the one file that you can use inside your component, because is a build css file).IMO you should create a
index.scss
and then import every component style file (like_header.scss
) after importing_custom boostrap
andboostrap
and then import in theApp.js
theindex.css
that the script will generate on every change of any.scss
file in the/src/assets
folder, but this is just a way to do it I understand that can be more clear to have it in every component folder.If needed I can take a look if you have a public repo.
Hope it helps.