简体   繁体   English

使用angular cli 6项目在chrome中的工作区中使用组件css文件

[英]Working with component css files in workspaces in chrome with angular cli 6 project

I'm trying to use Google Chrome workspaces with CSS persistent editing in an Angular 6/7 CLI project. 我正在尝试在Angular 6/7 CLI项目中使用Google Chrome工作区和CSS持久编辑。

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. 在angular.json配置中添加“extractCSS:true”并使用“--source-map = true”标志时,我可以在Chrome中的“sources”和“elements”标签中看到CSS文件,我可以将其映射到在线CSS文件,但在“元素”面板中更改样式时,更改不会持久,也不会保存到文件中。

Is it possible to edit the component CSS files from within Chrome dev tools with workspaces (without ejecting the app) ? 是否可以使用工作区从Chrome开发工具中编辑组件CSS文件(不弹出应用程序)?

  • 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: 在下面的GIF中,您可以看到虽然文件名附近的小绿点已打开,表示已建立网络资源和本地文件之间的映射,但元素面板中的更改不会反映在文件中:

更改未保存到文件

@Kayce Basques, the technical writer of Chrome DevTools commented on a question similar to this one, saying: Chrome DevTools的技术作家@Kayce Basques评论了一个与此类似的问题 ,他说:

DevTools technical writer here. DevTools技术作家在这里。 The workflow that benshabatnoam posted is the best we've got. benshabatnoam发布的工作流程是我们得到的最好的。 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. 从“元素”面板>“样式”窗格进行编辑适用于基本项目,但在使用源图并执行大量构建转换的框架(例如Angular)时遇到问题 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 :( 不幸的是,你的问题的答案是否定的 ,我们不能(至于今天)在Chrome开发工具中使用工作区编辑组件CSS文件:(

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM