Not able to require a local css file
See original GitHub issueMy resources folder looks like this:
resources
-css
-bootstrap.min.css
I am trying to require a new bootstrap file like this in my start function:
...
pl.treksoft.kvision.require("./css/bootstrap.min.css")
...
However, I get a 404 not found error. Just as in the showcase example, I’ve got this copy resources task defined in my build.gradle:
task copyResources(type: Copy) {
from "src/main/resources"
into file(buildDir.path + "/js")
}
The copyResources
task does the right thing and copies it into build/js/css/bootstrap.min.css
, but it doesn’t let me require the css file in my code
Issue Analytics
- State:
- Created 4 years ago
- Comments:11 (11 by maintainers)
Top Results From Across the Web
html does not load local css file - Stack Overflow
Go to the network tab. Refresh the page. Is the file listed in that list? You may have to refresh your cache to...
Read more >Solving the React Error: Not Picking Up CSS Style | Pluralsight
This error is generated because the compiler is only able to import files from the src folder. Here, the CSS file is saved...
Read more >How do I link to my css stylesheet for local file? - Codecademy
If I'm editing code locally on say TextEdit, and open it with Chrome, how do I link to my .css File? what is...
Read more >css-loader | webpack - JS.ORG
If, for one reason or another, you need to extract CSS as a file (i.e. do not store CSS in a JS module)...
Read more >How to include one CSS file in another? - GeeksforGeeks
Yes, It is possible to include one CSS file in another and it can be done multiple times. Also, import multiple CSS files...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
To override default bootstrap css you should add the
<link href="css/bootstrap.min.css" rel="stylesheet">
to theindex.html
file, but thebootstrap.min.css
file you want to use should be put intosrc/main/web/css
directory (not thesrc/main/resources
). Norequire()
is necessary. This file (all files and directories fromweb
) will be copied “as is” to thebuild/distributions/*
and will be included in the page as a normal static file. You probably need to putfonts
directory intoweb
as well.Could you paste here the log with this 404 error? Is it from the browser console or from gradle process? Do you have this problem during development or production build?