Open acarlstein opened 4 years ago
My question would be: Why?
So assuming you're trying to do (2.), my recommendation would be: don't.
and as a sidenote, even though from your perspective the problem originates with a Vue CLI config option, the part responsible for this is vue-loader & scss-loader, not the CLI itself.
My question would be: Why?
1. If your app.scss only contains variables and mixins, its not necessary to include it as there's not scss that uses these variables and mixins. 2. If your app.scss includes actual (s)css that results in markup, you are duplicating styles across each and every one of your components, wether they actually need or use them nor not - leading to a possibly **very, very, very** large css file with loads of duplicate and unused styles.
So assuming you're trying to do (2.), my recommendation would be: don't.
and as a sidenote, even though from your perspective the problem originates with a Vue CLI config option, the part responsible for this is vue-loader & scss-loader, not the CLI itself.
@LinusBorg, allow me to explain. At the moment I reported this issue, we were dealing with three things. First, we needed to break down the project into small Vue components. Second, we needed to ensure to follow a theme which was provided to use as multiple SCSS files. Third, it was required that we could modify the theme of the whole site by just adjusting these variables and mixins hold in these SCSS files.
These variables go beyond doing the simple thing of setting a palette of colors. These variables would affect the padding, margin, animation and many other properties across the application. It would affect multiple component.
The concept provided to us was to build a Vue project were the UI/UX could be changed from the SCSS. In this way, they could give it to someone who doesn't care about learning Vue but has knowledge on SCSS.
Anyways, thanks for your time. I hope I managed to clarify any misunderstandings.
thanks for the feedback, but I'm not sure I understand the bottom line: do you still have an issue? and if so, what is it?
These variables go beyond doing the simple thing of setting a palette of colors. These variables would affect the padding, margin, animation and many other properties across the application. It would affect multiple component.
I'm not sure I get that, either. is the SCSS that you import just logic, or does it end up creating actual CSS for the component?
As I explained If it's the latter, it should not be included globally
thanks for the feedback, but I'm not sure I understand the bottom line: do you still have an issue? and if so, what is it?
These variables go beyond doing the simple thing of setting a palette of colors. These variables would affect the padding, margin, animation and many other properties across the application. It would affect multiple component.
I'm not sure I get that, either. is the SCSS that you import just logic, or does it end up creating actual CSS for the component?
As I explained If it's the latter, it should not be included globally
@LinusBorg, I apologize if I couldn't be clear.
The idea behind is to have a main folder with SCSS files that shape the UI/UX of all VueJS components created with Vuetify.
We managed to do this successfully; however, we notices that for a component to obtain the CSS from the SCSS, must have a style
element scoped in the file, even if its empty.
I understand your point that it shouldn't be included globally; however, this was a corporate mandate. Those in charge to decide what the UI would look like don't want to learn VueJS. They want to setup SCSS files in a single folder.
Now, there it isn't a problem. We just leave an empty scoped style element in the file and it works. It would be a nice to have, not having to leave empty elements but I guess it is what it is.
Thank you for your time.
Version
4.1.1
Environment info
Steps to reproduce
Setup your
vue.config.js
to load the css:What is expected?
You would expect that the
app.scss
SCSS file would be loaded in everyvue
component, always.What is actually happening?
The
app.scss
SCSS file is only loaded into the component if and only if the component has a non-empty style tag as shown below:If the component doesn't have this non-empty style tag, then the SCSS is not loaded.
When over the documentation and search online but I couldn't find a solution to this. While the problem is not critical, it would be nice to have an option that guarantee that the SCSS file would be loaded to every component regardless if the component has or not a non-empty
style
tag.Thank you for you time.