Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Angular2 :host selector #1990

Closed
cescoferraro opened this issue Apr 12, 2016 · 1 comment
Closed

Angular2 :host selector #1990

cescoferraro opened this issue Apr 12, 2016 · 1 comment

Comments

@cescoferraro
Copy link

Originally posted this at dlmanning/gulp-sass#464
And got advised to open the issue here.

Consider the fact that Angular uses :host as a component selector
https://angular.io/docs/ts/latest/guide/component-styles.html

I am using a simple gulp task like

var gulp = require('gulp');
var sass = require('gulp-sass');
gulp.task('sass:compile', function () {
    //noinspection JSUnresolvedFunction
    return gulp.src('./test.sass')
        .pipe(sass().on('error', sass.logError))
        .pipe(gulp.dest("./sass"));

});

Test1

test.sass

body
  background-color: green
:host
  background: #000

sass output

Error: Properties are only allowed within rules, directives, mixin includes, or other properties.
       If ":host" should be a selector, use "\:host" instead.
        on line 3 of test.sass
  Use --trace for backtrace.

gulp-sass output

body {
  background-color: green; }

:host {
  background: #000; }

Test2 - Escaping the selector as suggested by sass

test.sass

body
  background-color: green
\:host
  background: #000

sass output

body {
  background-color: green; }

:host {
  background: #000; }

gulp-sass output

body {
  background-color: green; }

\:host {
  background: #000; }
@mgreter
Copy link
Contributor

mgreter commented Apr 16, 2016

I opened an issue upstream at sass2scss.
The behavior doesn't seem to be documented ...

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

No branches or pull requests

2 participants