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
Adding external styles or scripts does not work if project is create without --link-cli #1859
Comments
I ran into the exact same problem, however, i was not able to get your example using --link-cli to work, see below — could it be that your use of See this article which shows an example usage of Seems to me the purpose of Regardless — on my system, with the Can you post the 2 different versions of |
Hmm now after reinstalling the angular-cli I cannot reproduce it as well. Perhaps I did something else, but I still have 2 different angular-cli.json file from previously generated projects. The one which is generated by default (in which addin bootstrap does not work): The one I somehow managed to generate (thought it is --link-cli param) where everything works fine: also project structure is a bit different for second json file. |
Ok now I understand what has happened. It has nothing to do with --link-cli param. I first installed the angular-cli using: npm install -g angular-cli@webpack which generates first json file which does not work (for including external scripts). Then I was looking into e2e tests for angular-cli in github and I cloned the repository and run e2e tests to check if test for external resources passes. It looks like running e2e tests override the previously installed angular-cli with the angular-cli built from the cloned repo. After that 'ng new' is generating projects with different angular-cli.json and different file structure where adding external js/styles works. It looks like difference is a difference between the angular-cli@webpack published to npm and current angular-cli code from github. Is there a chance you guys will make a release soon? Best, |
Also having this issue. |
Same here. The "styles": ["styles.css"],.. doesn't work at all. |
Same here, both "styles" and "scripts" seem to be ignored. |
Same here, installing first globally ( npm install -g angular-cli@webpack ) and later locally ( npm install --save-dev angular-cli@webpack ) and finally ng init ( upgrades to RC5 ) but the angular-cli.json generated with both commands are without the styles and scripts array. Edit: It looks now that with "ng new" the package.json has updated to RC5, but still using the wrong angular-cli.json |
If i am correct, you need to add styles and scripts yourself to |
upgrading to webpack (8) release fix the issue for me. |
hi @carlosvalle, can you please post your angular-cli.json, jsut installed .8 and I still doesn't work for me. cheers |
Yep, last webpack version (1.0.0-beta.11-webpack.8) is working well with ' "styles": ["styles.css"] ' now. I didn't try with "scripts" though.. |
This looks like it was a version mismatch. I advice you to update to the latest version, see https://github.com/angular/angular-cli#webpack-update |
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
MacOSX
Versions. Please run
ng --version
. If there's nothing outputted, please runin a Terminal:
node --version
and paste the result here:6.2.2
Repro steps. Was this an app that wasn't created using the CLI? What change did you
do on your code? etc.
-- create new project following readme: ng new test-project
-- add external bootstrap styles and scripts following readme docs
-- run: ng build
no scripts nor styles are bundled.
The log given by the failure. Normally this include a stack trace and some
more information.
none
Mention any other details that might be useful.
Everything works correctly when you setup project using:
ng new test-project --link-cli
this happens because depending on how you generate project (with or without --link-cli) project is created with different angular-cli.json files.
Proposed solution:
2 If --link-cli not being default is desired please document this flag and explain what it does and what is difference and why scripts and styles can be added only for this particular angular-cli.json setup (perhaps it is just a bug).
I have noticed that your e2e tests always use --link-cli when creating project that is why this was probably missed, and this way I have found out how to generate setup where I can add external 3rd party scripts and styles.
The text was updated successfully, but these errors were encountered: