macOS Sierra
angular-cli: 1.0.0-beta.24
Using ng serve i don't see any directory created. Where do the files go that localhost:4200 links to?
Scss compilation (e.g. with Boostrap) is veeeery slow. So i wanted to use gulp to compile scss but i need to know in which path i should save the output file.
I already tried to change outDir in angular-cli.json and added "output-path": "dist" in environment.ts but still i dont see any folder created on ng serve. It only affects ng build.
ng serve does in memory and does not write to disk. You need to do ng build --watch to get it to write to disk and also update with changes. Also if you switch the project to be scss in the angular-cli.json you can put the scss files directly in the components, I have not had any performance issues.
Thanks that looks neat! But the server is not running then right? Thats crucial.
To reproduce just create a new project and try to compile it with bootstrap:
@import '../node_modules/bootstrap/scss/bootstrap';h1 { color:red; }Btw this is nothing new e.g. the regular ruby compiler (gem install sass) takes similiar times, while Gulp uses a compiler written in C (called libsass) which super fast.
libsass is currently being used. There is an ongoing effort to improve the speed overall.
Also, the first reload is always longer than subsequent reloads. Still takes several seconds though.
@MickL ahh missed that part. We use a node server where I work to serve the static files for everything but our component lib. Our component lib takes 2552-2745ms to build using bootstrap 4 alpha 5 and cli.24 on my MBP.
Thats still a lot though. A frontend-developer probably has to see changes immediately(<1sec). Libsass does it in some ms. Is there any chance to use gulp with ng serve since i cant access the server dir?
I was using compass before and ng serve detected the file changes without issue. Try putting the scss next to the css file and writing to the imported css file (in source).
Thats an option! Using angular cli with normal css and the styles.css is the compiled file by gulp/grunt/compass/whatever with inline sourcemaps.
@MickL , if viewEncapsulation is irrelevant in your case. Then u can have a separate npm module with gulp to compile *.scss files to a css file and copy the same into the angular-cli project and include the same in the styles array of the angular-cli.json file. I believe u can implement everything u need using the gulpfile.js and if necessary sh or bat file to copy with the angular-cli project.
So the original issue: ng serve is all in memory, like Zachary said. If you want files you need to run ng build.
What's the current issue? If you build SCSS and output the CSS somewhere and you link it, it will be included in your page. I don't see an issue outside of the original. Closing this as WAI; build times are always worked on and improved.
So the solution including the compiled styles into angular-cli.json doesnt work. Yes Gulp is compiling fine, but then again there is a webpack rebuild ofcourse.
Still not sure how to add files to dist/localhost on ng serve.
There should be a folder called public maybe. But if then it should be a symlink or something so files are available in realtime on localhost.
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._
Most helpful comment
ng servedoes in memory and does not write to disk. You need to dong build --watchto get it to write to disk and also update with changes. Also if you switch the project to be scss in theangular-cli.jsonyou can put the scss files directly in the components, I have not had any performance issues.