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

Angular2 :host selector issues #464

Closed
cescoferraro opened this issue Apr 12, 2016 · 2 comments
Closed

Angular2 :host selector issues #464

cescoferraro opened this issue Apr 12, 2016 · 2 comments

Comments

@cescoferraro
Copy link

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; }
@xzyfer
Copy link
Collaborator

xzyfer commented Apr 12, 2016

Please file this issue with LibSass.
On 12 Apr 2016 2:58 PM, "cesco" notifications@github.com wrote:

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; }


You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub
#464

@xzyfer
Copy link
Collaborator

xzyfer commented May 3, 2016

This has been fixed in node-sass@v3.7.0

@xzyfer xzyfer closed this as completed May 3, 2016
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

2 participants