admin管理员组文章数量:1180467
I'm using PHPStorm. This is very great software for web developers.
When I want to compress my CSS & JS files in PHPStorm , I can't find any option in PHPStorm.
So, Please tell me how to compress CSS & JS code in PHPStorm.
I'm using PHPStorm. This is very great software for web developers.
When I want to compress my CSS & JS files in PHPStorm , I can't find any option in PHPStorm.
So, Please tell me how to compress CSS & JS code in PHPStorm.
Share Improve this question asked Dec 17, 2012 at 9:54 JooxaJooxa 6373 gold badges12 silver badges27 bronze badges 2- 1 Usually build scripts should do so, not IDE – zerkms Commented Dec 17, 2012 at 9:55
- 1 jetbrains.com/phpstorm/webhelp/minifying-javascript.html – Real Dreams Commented May 29, 2013 at 3:12
3 Answers
Reset to default 21Found Assets Compressor plugin. See if it helps.
EDIT - Changed to the new link as pointed by @spade
PHPStorm supports minification by File Watchers. It supports integration with the YUI Compressor "out of the box", but it has some problems, e.g., with calc() function. My solution is to use minifier:
- Repeat the steps to install Node.js and npm from JetBrains manual
- Install minifier like YUI Compressor in manual (
npm install minifier
) - Minifier documentation says: "Installing through npm will create a binary (minify) in the usual locations", but I have not found it (perhaps it is not created on Windows).
Index.js
file can be executed vianode index.js
command, but PHPStorm does not maintain this way ("Please set program to run!" error will be thrown). So I created .bat file with the following content:
.
echo off
node path\to\minifier\index.js %*
- Then in PHPStorm watcher settings in
Program
input field we set path to the .bat file. Note that Minifier uses a different method for setting the output path, so we have to changeArguments
field:$FileName$ --output $FileNameWithoutExtension$.min.css
See the related feature requests:
- WEB-2138 Support automatic JavaScript and CSS minification
- WEB-2125 Pre- and post-deployment commands
At the moment you can use third-party tools/plug-ins like suggested by @Pushpesh.
本文标签: javascriptCompress CSS amp JS code with PHPStormStack Overflow
版权声明:本文标题:javascript - Compress CSS & JS code with PHPStorm? - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738216281a2069521.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论