问题
I'm trying to use Google Chrome workspaces with CSS persistent editing in an Angular 6/7 CLI project.
When adding "extractCSS:true" in angular.json configuration and using "--source-map=true" flag I can see the CSS file in the "sources" and "elements" tabs in Chrome, and I can map it to the online CSS file, but when changing the style in the "elements" panel the change is not persistent and is not saved to the file.
Is it possible to edit the component CSS files from within Chrome dev tools with workspaces (without ejecting the app) ?
- In the following GIF you can see that although the little green dot near the file name is on, indicating that the map between the network resource and the local file has been established, the changes from the elements panel are not reflected in the file:
回答1:
@Kayce Basques, the technical writer of Chrome DevTools commented on a question similar to this one, saying:
DevTools technical writer here. The workflow that benshabatnoam posted is the best we've got. Set up a Workspace and then edit your files from the Sources panel. Editing from Elements panel > Styles pane works on basic projects, but has trouble with frameworks (such as Angular) that use sourcemaps and do a lot of build transformations. Sucks, I know, but I recall that we've looked into it in-depth and our hands are tied until sourcemap usage is standardized.
Unfortenatly the answer to your question is NO, we can't (as for today) edit the component CSS files from within Chrome dev tools with workspaces :(
来源:https://stackoverflow.com/questions/53412086/working-with-component-css-files-in-workspaces-in-chrome-with-angular-cli-6-proj