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

Bootstrap Sass not recognized #1654

Closed
jurienhamaker opened this issue Aug 11, 2016 · 11 comments
Closed

Bootstrap Sass not recognized #1654

jurienhamaker opened this issue Aug 11, 2016 · 11 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@jurienhamaker
Copy link

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Running in docker on ElementaryOS (Latest)
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    angular-cli: 1.0.0-beta.11-webpack.2
    node: 5.12.0
    os: linux x64
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    Just upgraded to rc5.
  4. The log given by the failure. Normally this include a stack trace and some
    more information.
    None
  5. Mention any other details that might be useful.

I want to use the bootstrap-sass repo from npm, but webpack is not recognizing it.
I read about a bootstrap-sass-loader for webpack, but I can't find the webpack config file.
Anyway I can add/edit loaders etc.

@jurienhamaker
Copy link
Author

still nothing?

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label Aug 19, 2016
@filipesilva
Copy link
Contributor

Can you add repro steps to see the errors you are getting?

@jurienhamaker
Copy link
Author

  1. create a new project.
  2. npm install --save bootstrap-sass
  3. try to do @import 'bootstrap'; in component scss file.

@filipesilva
Copy link
Contributor

Components in Angular 2 have their css encapsulated, which means that they don't bleed out onto other parts of your app. Unfortunately, it also means that you can't really import bootstrap in your component.

We added global styles to address this: https://github.com/angular/angular-cli#global-styles. It should be available in the next webpack release.

@jurienhamaker
Copy link
Author

jurienhamaker commented Aug 30, 2016

Still doesn't really solve the problem, as importing bootstrap from it's npm package, can also include overriding variables just for that specific component.. Or using variables like the default padding to keep up with code styling throughout your application etc.

Global styles do not solve a sass import...

example:
component.scss:

@import "../../styles/bootstrap/bootstrap/variables";

I now have to import it from the downloaded source file, which I have to manually update. Instead of using the npm package.

It doesn't really matter if angular-cli has global styles, it matters that it recognizes npm sass packages.

More information
https://github.com/jtangelder/sass-loader

PS. I tried the ~ method in the sass-loader, still doesn't work with angular-cli

@jurienhamaker
Copy link
Author

jurienhamaker commented Aug 30, 2016

Long story short;
I am missing the ability to add custom loaders to webpack through angular-cli

@filipesilva

@filipesilva filipesilva reopened this Sep 21, 2016
@filipesilva
Copy link
Contributor

I'm a bit confused here.. we do support sass/less/styl, see https://github.com/angular/angular-cli#css-preprocessor-integration.

Doesn't your scenario work by defining your variable overrides in src/_variables.sass, your global (app wide) styles in src/styles.sass, and importing your variable overrides in src/styles.sass plus in your components?

Regarding custom loader, this is the relevant issue: #1656

@zoiverd
Copy link

zoiverd commented Sep 26, 2016

@filipesilva, this can resolve all the problems but If I import the variable files in multiple "app/my-component.component.scss" files, webpack still recognize as single variable file?

@filipesilva
Copy link
Contributor

As far as I know, yes.

@ahmed-musallam
Copy link

Angular cli uses sass-loader, look closely in the docs, you'll see you need to use "~" before your npm package sass file name.. https://github.com/jtangelder/sass-loader

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

4 participants