如何在 PHP storm 10.0.3 中启用 .js 和 .css 文件的自动压缩?
How to enable autominify of .js and .css files in PHP storm 10.0.3?
我想在编辑时正常查看 CSS 和 JS 文件。但是当我 save/upload 他们到服务器时,我希望他们 缩小 。当前版本的 PHPstorm 中是否有 plugin/setting 执行此操作?
PHPStorm 没有任何用于缩小文件的内置功能...但是网络上有很多不同的工具 - 此外,您还可以为此创建自己的批处理文件。
我可以建议使用 Grunt grunt-contrib-uglify and grunt-contrib-cssmin tasks, for example . Both tasks support merging and minifying files. You can run the tasks using Grunt console. Or, you can use YUI Compressor and set it up as a file watcher (https://www.jetbrains.com/webstorm/help/minifying-javascript.html, https://www.jetbrains.com/webstorm/help/minifying-css.html)
您可以在 PhpStorm 中添加 css 或 js File Watcher,请参阅他们的文档,使用 uglify 或 yuicompressor。所有配置都来自 IDE
正确设置后,您的 .css 和 .js 文件将在本地缩小(PhpStorm 在您的文件所在的左侧栏中很好地同时显示它们)。每次您更改原始 css 或 js 文件时,都会自动生成缩小版本。
上传到服务器时,只需要上传自动缩小的版本即可。
很方便。我将它用于非 Symfony 项目(在 symfony 中我使用 assetic 进行缩小并将资产合并到一个文件中)
我想在编辑时正常查看 CSS 和 JS 文件。但是当我 save/upload 他们到服务器时,我希望他们 缩小 。当前版本的 PHPstorm 中是否有 plugin/setting 执行此操作?
PHPStorm 没有任何用于缩小文件的内置功能...但是网络上有很多不同的工具 - 此外,您还可以为此创建自己的批处理文件。 我可以建议使用 Grunt grunt-contrib-uglify and grunt-contrib-cssmin tasks, for example . Both tasks support merging and minifying files. You can run the tasks using Grunt console. Or, you can use YUI Compressor and set it up as a file watcher (https://www.jetbrains.com/webstorm/help/minifying-javascript.html, https://www.jetbrains.com/webstorm/help/minifying-css.html)
您可以在 PhpStorm 中添加 css 或 js File Watcher,请参阅他们的文档,使用 uglify 或 yuicompressor。所有配置都来自 IDE
正确设置后,您的 .css 和 .js 文件将在本地缩小(PhpStorm 在您的文件所在的左侧栏中很好地同时显示它们)。每次您更改原始 css 或 js 文件时,都会自动生成缩小版本。
上传到服务器时,只需要上传自动缩小的版本即可。
很方便。我将它用于非 Symfony 项目(在 symfony 中我使用 assetic 进行缩小并将资产合并到一个文件中)