StyleSheet file in output folder [closed] - css

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 3 years ago.
Improve this question
I'm new in reactJs and I'm using webpack-dev-server to compile and check my code, the problem is that when I add a stylesheet to the sources as an imported file in the result everything is shown well and also in the output folder with the plugin I've imported the bundle.js file update but there is no sign of stylesheet file
My question is that what happened to the css file ? is that necessary to be there? or the styles are composed by the output js file? because when i moved the file it works fine again without any problem.
tnx

In production you probably wants to include all your CSS in one bundle file minifiying the result and exclude all CSS files not minified you used for actual development.
To do this you could use a CSS Loader, there are several options, one could be:
https://github.com/webpack-contrib/css-loader
An interesting article, it should help you to get started:
https://medium.com/trabe/multiple-css-bundles-with-webpack-75f263095f09

Related

How does react manage CSS? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed last year.
Improve this question
So for example for the HTML we have the index.html file on the public folder that we can clearly see. Now my question is how bout CSS. I have CSS for each of my components of a react application but I want to use things like variables and constants that run across an application.
Someone explain this to me.
You should define all variables and constants that you want to use across your project, in one file and import in App.js or index.js as a css file.
App.js
import "./style.css"
styles (classes) that you define in this file, are accessed all over your project.

Styling with CSS in React [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
All the project gets affected by changes I make in any CSS file even if it's not imported to that file.
for example: If I created a file called test1.js and imported a file called test.css inside of it then created a new file called test2.js and gave the same classes to its components they get styled the same way as test1.js even without importing the CSS file into it.
How can I get around this problem? is using SASS away to avoid it?
Can you please recommend the best practice for styling in react?

Which is the most efficient way to load css? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 3 years ago.
Improve this question
I'm thinking of two options to load my css and wondering which one is the most efficient one?
Using small bits of css files and import them into a single main styles.css and use this file in the head section.
Using a common css file that contains code that applies to all pages and then create separate page-specific css files and include them in the page that need them. For example, the css for a contact page will only be used on the contact page so no need to load those css in other pages.
So which way would you go?
Thanks
The best way is using a single external "minified" CSS file for all pages. because the browser caches this file and then only the cached version will be loaded in the next load times. so your CSS load speed remains fast. but try to minify it .

How can i stop prepos to create certain compiled scss other than main.scss [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 3 years ago.
Improve this question
Kindly see the option that I've tried which dont worked out for me.
You can right-click on the file in Prepros and select Disable Auto Compile.
I don't want anything processed except for my "main.scss" file. Is there a way to prevent Prepos from processing certain scss files
For all other files except for main.scss, add "_" before the name.
They are called partials. For example _variables.scss, _header.scss or _footer.scss and include them all in the beginning of the main.scss file

CSS vs SCSS in Rails application [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I have css files for a web application, how do I use it in Rails? I need to convert it to scss or to less? How do I go about doing this?
You don't have to convert your files to scss/sass/less, you can use it as is.
As #Mischa said you can continue to use css.
Copy your css files into assets/stylesheets then ensure application.css has the following include
*= require_tree .
This will then include all files withing the stylesheets folder.

Resources