Skip to content
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

Meteor 1.2 - cross-package imports #106

Closed
sebakerckhof opened this issue Aug 28, 2015 · 22 comments
Closed

Meteor 1.2 - cross-package imports #106

sebakerckhof opened this issue Aug 28, 2015 · 22 comments

Comments

@sebakerckhof
Copy link
Collaborator

Hello,

Meteor 1.2 has a new plugin interface, and the default less and stylus packages allow for cross-package imports using the {packagename}/file notation.

Are there plans to add support for this?

Regards,
Seba

@fourseven
Copy link
Collaborator

Hi, yes, I just need to find the time to work out what's new and what needs re-coding.

@sebakerckhof
Copy link
Collaborator Author

Okay, documentation is lacking in some areas, but I tried to hack together something minimal working based of the less and stylus packages. You can find it in this fork: https://github.com/sebakerckhof/meteor-scss

What seems to work:
SCSS compilation
Cross-package imports
Sourcemaps (Although, I'm not 100% sure how these are handled in meteor 1.2)
Caching (At least, I think so)

What is not included:
-Autoprefixing
-Support for any of the current options, although some of the options might not make sense with the new cross-package imports.

@sebakerckhof
Copy link
Collaborator Author

Btw, 'seems to work' means that I've tested it very quickly, with not to complex scenarios.

@fourseven
Copy link
Collaborator

Thanks, I've just turned it into a pull request, and will test it after work (approx 8-12 hours).

@dcworldwide
Copy link

Sounds amazing! Thanks so much for this

@fourseven
Copy link
Collaborator

I've merged it to master but have had problems running it on my projects – I've got a test repo here which it won't work with, it's related to scss partials and subdirectories. https://github.com/fourseven/meteor-scss-test

the error:

   While processing files with fourseven:scss (for target web.browser):
   client/scss/meteor-scss-test.scss:2:9: Scss compiler error: Cannot read file {}/imports.scss for /client/scss/meteor-scss-test.scss

@sebakerckhof
Copy link
Collaborator Author

Yeah, seems I forgot some use cases, I'll look at it tomorrow.

@fourseven
Copy link
Collaborator

No problem – I've added you as a collaborator, thanks for the work you've put in so far!

@sebakerckhof
Copy link
Collaborator Author

Okay, I've got a fix ready, but I want to run some more tests to make sure I didn't forget about anything this time. I also need to do some work on better error messages.

I've also created an autoprefix compiler, but there are some limitations with the current meteor build system, see: meteor/meteor#5219 which make it not really usable as of today. I hope to discuss this further with MDG soon.

@fourseven
Copy link
Collaborator

Thanks again for the work, sounds good.

That's a pain about auto-prefixer, could you link that issue in the README.md for this package as part of the updated 1.2 SCSS complier commit/PR please?

@sebakerckhof
Copy link
Collaborator Author

Okay, got some delay due to this meteor bug: meteor/meteor#5278 . Doesn't affect this package though.

I rewrote some parts, every use case I could think of should now work, but please verify. Changes in absolute files are not tracked by Meteor though. I believe the official less and stylus packages don't allow absolute paths, but I should also verify this.

I also removed the possibility to mark imports with *.import.scss as the SASS ways seems to be to prefix with an underscore, and one way is sufficient.

@robomatic
Copy link

I'm getting not found errors trying your fork. I'm using a package with api.addAssets(["path/to/_import.scss"], "server") then in my main.scss file in my main app @import "{my:package}/path/to/_import.scss"

@sebakerckhof
Copy link
Collaborator Author

That is correct, you need to add the file like this in your package.js definition:
api.addFiles(['path/to/_import.scss'],'client',{isImport:true})

@appinteractive
Copy link

How can I use this right now? Saw that v3.3.3 has support for this but there is no such version. And how do I add this to meteor at the moment? I'm trying to add materialize to my app and need to modify and access their variables (without braking the first run of the app where no build folder is available).

@fourseven
Copy link
Collaborator

Hi @appinteractive - clone it down to your /packages subfolder should do it (without the .git extension) I've almost finished testing, things go well and 3.3.3 will be out soon

@robomatic
Copy link

still no luck with my tests of the cross package import... I've created a quick meteor app to help test. https://github.com/robomatic/scsstest

@robomatic
Copy link

Sorry, I was wrong, it does work. I didn't have the api.use('fourseven:scss') in the package itself. Should that be an api.imply? I've updated the test sample.

@skirunman
Copy link

Any update on expected official release of 3.3.3? Thanks!

@fourseven
Copy link
Collaborator

Just published, thanks everyone!

@idoivri
Copy link

idoivri commented Oct 8, 2015

Hey @fourseven, what if I still encounter:
While processing files with fourseven:scss (for target web.browser): /client/css/style.scss: Scss compiler error: File to import: .meteor/local/build/programs/server/assets/packages/meteoric_ionic-sass/packages/meteoric_ionic-sass/_ionic not found. Import origin: /client/css/style.scss

Is it possible I have something wrong on my end?

@sebakerckhof
Copy link
Collaborator Author

meteoric ionic should be updated for the Meteor 1.2 and cross-package imports. In the meantime you can use fourseven:[email protected]

@rdewolff
Copy link

rdewolff commented Nov 1, 2015

Yep, using fourseven:[email protected] with meteor add fourseven:scss@=3.2.0 works.

Cf. longer thread on meteoric/ionic-sass#16.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants