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

fix(ngtools/webpack): further patch the ReflectorHost to understand encapsulation: None. #3256

Merged
merged 1 commit into from
Nov 29, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/webpack/src/reflector_host.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ export function patchReflectorHost(codeGenerator: CodeGenerator) {
reflectorHost.getImportPath = function(containingFile: string, importedFile: string): string {
// Hack together SCSS and LESS files URLs so that they match what the default ReflectorHost
// is expected. We only do that for shimmed styles.
const m = importedFile.match(/(.*)(\..+)(\.shim)(\..+)/);
const m = importedFile.match(/(.*)(\.css|\.scss|\.less|\.stylus)((?:\.shim)?)(\..+)/);
if (!m) {
return oldGIP.call(this, containingFile, importedFile);
}
Expand All @@ -21,6 +21,6 @@ export function patchReflectorHost(codeGenerator: CodeGenerator) {
const [, baseDirAndName, styleExt, shim, ext] = m;
const result = oldGIP.call(this, containingFile, baseDirAndName + '.css' + shim + ext);

return result.replace(/\.css\./, styleExt + '.');
return result.replace(/\.css($|\.)/, styleExt + '$1');
};
}
6 changes: 3 additions & 3 deletions tests/e2e/assets/webpack/test-app/app/app.component.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// Code generated by angular2-stress-test
import {Component, ViewEncapsulation} from '@angular/core';

import { Component } from '@angular/core';

@Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
styleUrls: ['./app.component.scss'],
encapsulation: ViewEncapsulation.None
})
export class AppComponent { }
1 change: 0 additions & 1 deletion tests/e2e/assets/webpack/test-app/app/app.module.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
// Code generated by angular2-stress-test
import { NgModule, Component } from '@angular/core';
import { BrowserModule } from '@angular/platform-browser';
import { RouterModule } from '@angular/router';
Expand Down