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

Q: Using compass and other sass mixins with angular-cli? #2115

Closed
m-abs opened this issue Sep 14, 2016 · 11 comments
Closed

Q: Using compass and other sass mixins with angular-cli? #2115

m-abs opened this issue Sep 14, 2016 · 11 comments

Comments

@m-abs
Copy link

m-abs commented Sep 14, 2016

I can see compass support recently have been removed from angular-cli, is there a way to install it ourselves in our project?

What about other sass mixins like sass-flex-mixin? I've tried to install the node module and add the path ../node_modules/sass-flex-mixin/_flex.scss to styles in our angular-cli.json file, but I just get this error:

ERROR in ./src/app/app.component.scss
Module build failed: 
@import "sass-flex-mixin/_flex";
^
      File to import not found or unreadable: sass-flex-mixin/_flex
@leon
Copy link
Contributor

leon commented Sep 15, 2016

sass / webpack has a special way of including other node_module packages.

if you write ~ before the import it goes and looks for it in node_modules

@import "~sass-flex-mixin/_flex";

https://github.com/jtangelder/sass-loader#imports

@filipesilva
Copy link
Contributor

See #1656 for a discussion regarding overriding webpack config.

Your imports can reference node_modules either by using ~ as @leon suggested, or by putting in the full relative path (../../node_modules/sass-flex-mixin/_flex).

@neha-s16
Copy link

@m-abs Were you able to include compass as a third party library? Or any other library?

@m-abs
Copy link
Author

m-abs commented Jan 16, 2017

@neha-s16
We moved away from angular-cli, it was too much overhead for our needs.

@neha-s16
Copy link

@m-abs So what did you use instead? We are facing too many issues as well.

@m-abs
Copy link
Author

m-abs commented Jan 16, 2017

@neha-s16
I wish I could give you simple answer with just one tool, but I can't.

Our main project is based on this seed-project https://github.com/NathanWalker/angular-seed-advanced.
It gives us the tooling needed to develop for web, desktop (electron) and mobile (nativescript) with a shared code base.

Our real problem were our modules and their demo projects.
We started out with the angular-cli, which isn't/wasn't geared towards developing modules, when we ran into this issue we decided to switch to gulp.
I've a baseproject we used: https://github.com/m-abs/typescript-baseproject/tree/ng2-ngc (sorry not up-to-date).
But after we ran into some problems with building and publishing modules with ngc-metadata, we started to move away from gulp and I think we'll end up using npm scripts for building all our modules. These scripts run tsc, ngc, tslint, node-sass and so on.

We have a simple web-app based on https://github.com/manekinekko/angular-aot-demo It's just a demo for building with AOT, but it was enough for our need.

I think I'd look at https://github.com/mgechev/angular-seed if I were to make a web-only app today. It's the project the seed we use is based upon.

@raff77
Copy link

raff77 commented Mar 29, 2017

@elegance-pooja-123
Copy link

elegance-pooja-123 commented Jul 28, 2017

if there is any issue in the scss mixin
Module build failed:
@import "~compass-mixins/lib/compass";
^
File to import not found or unreadable: ~compass-mixins/lib/compass.

so solution is

  1. npm install compass-mixins
  2. npm install compass-mixins --save that save your file or package.

then run
ng serve

@UmarEhsan
Copy link

Thanks @elegance-pooja-123

@moamen-ui
Copy link

The problem shows while run "ngc", but works good while run "ng serve" !

@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 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants