-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question about sharing styles between app and package #129
Comments
It's been a very long time since I've used it, but the syntax (handled here in the code) should be Examples for packages:
|
I tried to give this a try: Reference the package's stylesheet with the provided syntax in my app's stylesheet with
and I have a package, but for some reason, I get build errors like so:
And in the browser:
I tried to: a) import those stylesheets directly in my app via ...but it didn't do any good. I wonder what I might be doing wrong? |
Trying to replace references of
However, this |
Using the symlink strategy it seems I managed to get this style sharing pattern to work, though I would have much preferred the syntax you proposed for being more concise! |
Glad to hear that worked, but please give
.title {
composes: header from 'meteor/arggh:ui/styles/typography.m.css';
}
.header {
font-size: 50px;
}
Package.onUse(function(api) {
api.versionsFrom('1.8.0.2');
api.use('ecmascript');
api.use('nathantreid:css-modules@4.1.0-beta.1');
api.addFiles('styles/typography.m.css', 'client');
}); Sample project here: https://github.com/nathantreid/css-modules-129 |
Actually I take my word back,
...those composed styles did not get included. But with the I did as you instructed, but with one "odd" addition: I had to refer to the shared stylesheets with the Anyway, this is really great, thanks! |
Hmm, direct path reference should work inside the packages - I'll have to take a look. Thanks for the feedback! |
The console was bombarded by hundreds of missing file errors on build when trying to reference those shared stylesheets directly, but after prepeding |
Though, I'm having other issues with the Meteor bundler at the same time, I have no idea if related at all: meteor/meteor#10496 They don't seem to be connected from my perspective, but I thought I should mention. |
@nathantreid I've been running the beta with no issues so far. |
First and foremost, I'd like to thank you for an amazing package. We've been using it in production for some years already and it's just pure awesome.
Now, I've come by a situation where I thought some guidance might help greatly.
In our app, we've applied this type of pattern generously, where...
layout.m.css
,button.m.css
ortypography.m.css
composes
to compose my styles from those shared stylesheets, whether it was for components or pages, layouts etc.This has worked wonderfully and has allowed me to define the basic bits and pieces of our styles in a reusable fashion. This way, if I have 5 different components that have some sort of inputs, all of the use
compose
to derive their basic apperance from those shared stylsheets. All good so far.Now the problem:
I'm in the process of moving all our common components, like
modal
,title
,button
etc. to a Meteor package.Is there an existing way of still sharing those common stylesheets across the app / package boundary, so that they could be used in both places?
My initial plan of action was to put the stylesheets in a dedicated directory outside of both app and package folders and then create symbolic links to both the app and package to be consumed by CSS Modules (we have a monorepo structure, but Git submodules could achieve the same effect).
Is there a better way, perhaps?
I already learned about sharing config between the app and package from this issue, but I didn't find anything about sharing stylesheets in any of the existing issues.
Once again, thanks for this package!
The text was updated successfully, but these errors were encountered: