Closed gadicc closed 8 years ago
Meteor 1.3.2 changes the way css files are imported. :frowning: I've got some more digging to do, but for now you can make the example work by changing the outputJsFilePath
option in package.json:
"cssModules": {
"outputJsFilePath": "{dirname}/{basename}.js"
}
This issue affects the whole of my CSS modules plugin, see nathantreid/meteor-css-modules#24.
this is probably dumb, but @gadicc how did you make that code block collapsable? V cool.
Thanks, @nathantreid! I got past the "attempting to combine different files" problem but then was back with to original substr
(from sourceMap) crash. I just commented out this line and everything works again, didn't investigate any further yet.
Btw, what are your thoughts about ditching addStyleSheet
and shipping each style sheet in it's own module via addJavaScript
along with the other code you have to have there anyways? From that point I think we're just 2 steps away from hotloading support :) Only downside I can think of is missing out on some css-specific minification optimizations.
@newswim, haha, everyone (including me) has the same reaction when they see it for the first time. Read this, the "discourse expandable post" link in the next post, and the comments in the post after that.
@nathantreid we can move this back to my original issue if it's more relevant there.
This is probably more relevant in the other issue, but I'm fine with just continuing it here.
I can't totally ditch addStylesheet
since I actually need to have the CSS file for some of my apps, although I'm open to making it optional - the addStylesheet
call is only used for non-lazy stylesheets; each lazy-loaded stylesheet is already "in it's own module via addJavaScript
along with the other code", so that would be a pretty simple switch to add. The question then becomes which to make the default.
If we got hotloading working, I'd definitely turn that on for my development process!
The primary downside is if you use SSR, the styles won't load until the JS does.
Oh, and I had the same reaction to the collapsible code block you have up there!
fyi, this is how the hidden code trick is done:
<details>
<summary>Q1: What is the best Language in the World? </summary>
A1: JavaScript
</details>
Hey @nathantreid, I thought it might be better to track all this stuff here. I'm going to close https://github.com/nathantreid/meteor-css-modules/issues/23.
Starting point, clone this repo,
meteor npm install && meteor
, everything works. Then:I then get the error I mentioned previously:
so I remove from
package.json
:and then get:
`Error: Attempting to combine different files: client/components/style.scss`
``` Error: Attempting to combine different files: { type: 'js', sourcePath: 'client/components/style.scss', servePath: 'client/components/style.scss', installPath: 'client/components/style.scss', deps: { './style.css': {} }, lazy: true, data:Not sure what else I can try from here.
On my real project, I don't get this error. Even after removing
explicitIncludes
, I'm still stuck with thesubstr
error. But I'll look at that separately.Thanks for the help!