question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Not able to require a local css file

See original GitHub issue

My 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:closed
  • Created 4 years ago
  • Comments:11 (11 by maintainers)

github_iconTop GitHub Comments

1reaction
rjaroscommented, Apr 4, 2019

To override default bootstrap css you should add the <link href="css/bootstrap.min.css" rel="stylesheet"> to the index.html file, but the bootstrap.min.css file you want to use should be put into src/main/web/css directory (not the src/main/resources). No require() is necessary. This file (all files and directories from web) will be copied “as is” to the build/distributions/* and will be included in the page as a normal static file. You probably need to put fonts directory into web as well.

1reaction
rjaroscommented, Apr 3, 2019

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?

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found