question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support sass mixin and variables within component style

See original GitHub issue

Hi, Is it possible to use sass mixins and variables within component’s style?

For instance I import bourbon in the main style.scss:

/* You can add global styles to this file, and also import other style files */
@import '~normalize.css';
@import '~animate.css';
@import '~bourbon/app/assets/stylesheets/bourbon';
@import '~bourbon-neat/app/assets/stylesheets/neat';

I want to be able to do the following in app.component.scss

:host{
  @include linear-gradient(to top, red, orange);
  background-color: $primary;
}

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
grizzm0commented, Jan 26, 2017

Simply import it again wherever you need the function/variable. Just as you’d need to import any typescript function/variable you’ve exported.

They will not impact the build size in any way as they just contain mixins/variables.

0reactions
angular-automatic-lock-bot[bot]commented, Sep 9, 2019

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

mixin and @include - Sass
Mixins allow you to define styles that can be re-used throughout your stylesheet. ... are available within the mixin's body as the corresponding...
Read more >
How to Use Mixins in Sass and Pass Arguments – With Code ...
But an argument allows you to define different styles by turning them into variables. It's like customizing each style for each element.
Read more >
How to use CSS variables with Sass Mixins - Medium
CSS Variables and Sass mixins are each potent on their own. With some creativity, we can make them work together towards more flexible...
Read more >
How to combine SASS color functions and CSS Variables
You can include CSS variables into SASS mixins and functions, but the code above would return an invalid value (--var(color) is replaced by...
Read more >
SASS Best Practices: 9 frontend tips for CSS preprocessors
Introduction to SASS; SASS Architecture; Variables in SASS; Using Interpolation; SASS Extends; SASS Mixins; Imports and other at-rules
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found