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

[windows][dart][alpha.51] Transformer error on @View styleUrls #5772

Closed
avoivo opened this issue Dec 10, 2015 · 8 comments
Closed

[windows][dart][alpha.51] Transformer error on @View styleUrls #5772

avoivo opened this issue Dec 10, 2015 · 8 comments
Assignees

Comments

@avoivo
Copy link

avoivo commented Dec 10, 2015

I have the following component

@Component(
  selector: "main"
)
@View(
  templateUrl: "package:angular2_example/components/main_component.html",
  styleUrls: const ["package:angular2_example/components/main_component.css"]
)
class MainComponent{

}

and when i execute 'pub build' i get the following

[Info from Dart2JS]:
Compiling angular2_example|web/main.dart...
[Error from Dart2JS on angular2_example|web/main.dart]:
packages\angular2_example\components\main_component.css.shim.dart:5:28:
Can't find ']' to match '['.
\n}'];lor:red;YLES = const ['div[_ngcontent-%COMP%]{
                           ^
[Error from Dart2JS on angular2_example|web/main.dart]:
packages\angular2_example\components\main_component.css.shim.dart:5:71:
Expected a declaration, but got '}'.
\n}'];lor:red;YLES = const ['div[_ngcontent-%COMP%]{
                                                                      ^

I have created an example here.

I also have tested it on a Ubuntu machine on which 'pub get' executed without any problems.

Dart VM versions on both machines is 1.13.0

@IgorMinar
Copy link
Contributor

@kegluneq please take a look

@kegluneq kegluneq assigned tbosch and unassigned kegluneq Dec 10, 2015
@kegluneq
Copy link

Sorry to pass this on, but the transformer does not know anything about the content of the stylesheets, it just outputs whatever is passed to it. This looks like it has to do with the StylesheetCompiler output.

https://github.com/angular/angular/blob/master/modules_dart/transform/lib/src/transform/stylesheet_compiler/processor.dart

@tbosch
Copy link
Contributor

tbosch commented Dec 10, 2015

Just tried with Dart 1.12 and Dart 1.13: This example works in Dartium as well as in Chrome (via dart2js). I did the following:

  1. git clone git@github.com:avoivo/angular2_example.git
  2. cd /angular2_example
  3. pub get
  4. pub serve
  5. open http://localhost:8080

@avoivo Could you please try the same steps in a new temporary folder to be sure your reproduction case works? Btw, I tested on MacOSX. What OS are you using?

@avoivo
Copy link
Author

avoivo commented Dec 11, 2015

@tbosch Just tried on a different pc with windows and i am also getting the same errors. The OS i am using in both those PCs is windows 8.1.

Also some new info that can be helpfull, when i chage the css file from this:

div{
color:red;
}

to this:

div{color:red;}

the transformer executes without an error . Seems that the newline character is responsible for the errors that i am getting.

@avoivo avoivo closed this as completed Dec 11, 2015
@avoivo avoivo reopened this Dec 11, 2015
@vicb
Copy link
Contributor

vicb commented Dec 11, 2015

From the description and the output file, it seems like "\n" are escaped in the output file but "\r" rewind to the start of the line. @kegluneq do we test that "\r\n" are correctly handle by the transformer (writer) ?

@kegluneq kegluneq assigned kegluneq and unassigned tbosch Dec 11, 2015
@kegluneq
Copy link

I don't think we have an explicit test for it, let me take a look

@kegluneq
Copy link

_styleCodeGen calls compiler/util.ts to escape the incoming style strings, but that util does not escape '\r' characters.

In Dart, we could pass the incoming css lines through the LineSplitter and avoid dealing with newlines altogether. I'm not sure what the equivalent would be in TS.

This should be tested along with util.

@kegluneq kegluneq assigned tbosch and unassigned kegluneq Dec 11, 2015
kegluneq pushed a commit to kegluneq/angular that referenced this issue Dec 11, 2015
kegluneq pushed a commit to kegluneq/angular that referenced this issue Dec 11, 2015
kegluneq pushed a commit to kegluneq/angular that referenced this issue Dec 11, 2015
@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 7, 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

Successfully merging a pull request may close this issue.

5 participants