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

[[email protected]] import stylesheet from npm package #165

Closed
sunstorymvp opened this issue Jan 22, 2016 · 32 comments
Closed

[[email protected]] import stylesheet from npm package #165

sunstorymvp opened this issue Jan 22, 2016 · 32 comments

Comments

@sunstorymvp
Copy link

just wonder is it possible?

1.3 introduces better npm support so we can just do npm install foundation-sites --save for example, but how to use it?

it's so easy to import js:

import Foundation from 'foundation-sites';

but in SCSS nothing of this works:

@import "{}/node_modules/foundation-sites/scss/foundation";
@import "node_modules/foundation-sites/scss/foundation";
@import "{}/foundation-sites/scss/foundation";
@import "foundation-sites/scss/foundation";
@sebakerckhof
Copy link
Collaborator

This is being discussed here: meteor/meteor#6037

@vitalyrotari
Copy link

Does not see any .scss file in the project on [email protected].
Any ideas on this subject?

@sebakerckhof
Copy link
Collaborator

@vitalyrotari Well, we just process the scss files Meteor tool feeds us. So this would require changes to meteor tool. Not much we can do with this package.

@vitalyrotari
Copy link

I think the problem is in the importer method. I am trying to figure out where in the issue, but for now without any results :(

@vitalyrotari
Copy link

Problem solved :)
Update compile-scss.js file

@sebakerckhof
Copy link
Collaborator

Can you create a PR

@vitalyrotari
Copy link

@sebakerckhof a bit later will do ;)

@tjmonsi
Copy link

tjmonsi commented Feb 2, 2016

Is this working already?

@sergiotapia
Copy link

Just ran into this issue @sebakerckhof. I created a new Meteor 1.2 project, added the fourseven:scss package, then npm install bulma.

This created the css files in node_modules:

$ tree node_modules/bulma/
node_modules/bulma/
├── LICENSE
├── README.md
├── bower.json
├── bulma
│   ├── base
│   │   ├── base.sass
│   │   ├── content.sass
│   │   ├── generic.sass
│   │   ├── helpers.sass
│   │   └── highlight.sass
│   ├── components
│   │   ├── card.sass
│   │   ├── components.sass
│   │   ├── grid.sass
│   │   ├── media.sass
│   │   ├── menu.sass
│   │   ├── navbar.sass
│   │   ├── table.sass
│   │   └── tabs.sass
│   ├── config
│   │   ├── generated-variables.sass
│   │   └── variables.sass
│   ├── elements
│   │   ├── buttons.sass
│   │   ├── controls.sass
│   │   ├── elements.sass
│   │   ├── messages.sass
│   │   ├── notifications.sass
│   │   └── titles.sass
│   ├── layout
│   │   ├── footer.sass
│   │   ├── header.sass
│   │   ├── hero.sass
│   │   ├── layout.sass
│   │   └── section.sass
│   └── utilities
│       ├── animations.sass
│       ├── functions.sass
│       ├── mixins.sass
│       ├── reset.sass
│       └── utilities.sass
├── bulma.sass
├── css
│   ├── bulma.css
│   ├── bulma.css.map
│   ├── bulma.min.css
│   └── bulma.min.css.map
├── images
│   └── bulma-banner.png
└── package.json

9 directories, 41 files

Then I manually created client/stylesheets/bulma.sass:

@import ../node_modules/bulma/bulma/utilities/utilities
@import ../node_modules/bulma/bulma/config/variables
@import ../node_modules/bulma/bulma/config/generated-variables
@import ../node_modules/bulma/bulma/base/base
@import ../node_modules/bulma/bulma/elements/elements
@import ../node_modules/bulma/bulma/components/components
@import ../node_modules/bulma/bulma/layout/layout

And I get:

 While processing files with fourseven:scss (for target web.browser):
   /client/stylesheets/bulma.sass: Scss compiler error: File to import: {}/client/node_modules/bulma/bulma/utilities/utilities not found in
   file: /Users/sergiotapia/Work/nanote/{}/client/stylesheets/bulma.sass

@sebakerckhof
Copy link
Collaborator

Filenames of file to import need to start with an underscore, otherwise meteor does not see the file as an import.

But even then it won't work due to a bug in lib-sass with old sass (indented syntax) files: sass/node-sass#1192

@HZSamir
Copy link

HZSamir commented Feb 17, 2016

Is this issue still pending? Any new development?

@skirunman
Copy link

@sebakerckhof Any update on this or the PR from @vitalyrotari, thanks!

@bliitzkrieg
Copy link

I am also looking for a solution to this

@tommy0311
Copy link

I follow these steps in meteor1.3, it works well
https://github.com/tableflip/meteor-sass-bootstrap4

@mbarqawi
Copy link

any solution to this issue , because the bootstrap solution is too much complex

@skirunman
Copy link

skirunman commented Apr 16, 2016

Meteor 1.3.2 should allow you to import scss files.

@import '{}/node_modules/foundation-sites/scss/foundation.scss';

See this repo for an example: https://github.com/juliancwirko/meteor-npm-foundation-test
Also, Bootstrap 4 example: https://github.com/juliancwirko/meteor-bootstrap-npm-test

@patrickml
Copy link

@skirunman does it only work if the file is SCSS? I am unable to get it to work with CSS files
@import "{}/node_modules/quill/dist/quill.css";

@ikhsanalatsary
Copy link

ikhsanalatsary commented May 14, 2016

@skirunman you can add css file in your js file. for instance:
import '../../../../node_modules/sweetalert/dist/sweetalert.css';

@iameli
Copy link

iameli commented May 25, 2016

That solution works just fine for CSS files, but it doesn't work for SCSS imports. I can't use that method to import mixins and such from an NPM module. Cross-referencing my response on meteor/meteor#6846 here.

@kashifnazar
Copy link

I am trying this

@import '{}/node_modules/slick-carousel/slick/slick-theme.scss';

But it yields the following error.

Unexpected token (3:1)

@Valodya
Copy link

Valodya commented Nov 18, 2016

any updates?

@yanickrochon
Copy link

As an effort to support npm, where is this issue currently at?

@sebakerckhof
Copy link
Collaborator

I recently moved to the bay area so I'm currently too busy to look into it, but a pull request would be accepted.

@ilan-schemoul
Copy link

ilan-schemoul commented Mar 11, 2017

Sorry but as Meteor tries to get closer to JS land it's incredibly important to being able to @import css files from npm packages, so is there any update ?
Importing via js is not always the good way as we may need the toolchain for his essentials features (compression, vendor prefix etc.)
EDIT : ping @sebakerckhof

@rafinskipg
Copy link

@sebakerckhof Any guidance or help would be good.

@yanickrochon
Copy link

After updating a few Meteor packages (also npm packages) any CSS files imported from my JS modules are no longer imported. Also, @import ... from my SCSS yield

While processing files with fourseven:scss (for target web.browser):
   /client/styles/global.scss: Scss compiler error: File to import: {}/node_modules/normalize.css/normalize.css not found in file:
   /path/to/project/{}/client/styles/global.scss

@nosizejosh
Copy link

@skirunman any updates on this issue please? I am currently doing this
import '../../../../node_modules/sweetalert/dist/sweetalert.css'; as workaround but it doesn't look ...

@skirunman
Copy link

@nosizejosh Sorry, but have not kept up on this as we are no longer using SASS or importing directly from node_modules. Hope you find a solution.

@nosizejosh
Copy link

@skirunman thank you.

@derwaldgeist
Copy link

Hey, I tried to - finally upgrade - my app to Meteor 1.3. But as in any other upgrade, fourseven:scss is causing the biggest problems. Now I stumbled upon this issue, trying to import styles from npm modules I had previously imported using mquandalle:bower. I hoped that - after so many months - this would have been fixed in the meantime. But is it really still open? I was also wondering how to import fonts that are referenced in SASS files. It was so easy using mquandalle:bower in 1.2, but now I am running into this upgrade nightmare.

@pilarArr
Copy link

This is being discussed here as well meteor/meteor/6846

@StorytellerCZ
Copy link
Member

Closing in favor of #309

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