Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/delphi/8.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 缩小并加入CSS&;linux上的JS文件,服务器端_Javascript_Css_Linux_Command Line_Minify - Fatal编程技术网

Javascript 缩小并加入CSS&;linux上的JS文件,服务器端

Javascript 缩小并加入CSS&;linux上的JS文件,服务器端,javascript,css,linux,command-line,minify,Javascript,Css,Linux,Command Line,Minify,例如,在我的项目中,我有以下结构: /public/js/src/ /* many jquery plugins there */ /public/css/src/ /* many css files there, that describe different things */ 进行更改后,我想在命令行中键入如下内容: root@hostname:/var/www/test/public# ./build 这将生成两个文件: /public/css/build.css - all fil

例如,在我的项目中,我有以下结构:

/public/js/src/ /* many jquery plugins there */
/public/css/src/ /* many css files there, that describe different things */
进行更改后,我想在命令行中键入如下内容:

root@hostname:/var/www/test/public# ./build
这将生成两个文件:

/public/css/build.css - all files from /public/css/src/ folder with minified source
/public/js/build.js - all files from /public/js/src folder with minified source

目前,我使用较少的css,这是在节点上工作。我想有一个脚本,将做一切,为css的javascript。您能建议“构建”开发人员源javascript和css文件的最佳方法吗?

您可以使用。我相信它也适用于Linux。 它在命令行中工作。它是如何工作的

例如:

java -jar yuicompressor-x.y.z.jar myfile.js -o myfile-min.js --charset utf-8

我相信您可以设置一个简单的Bash脚本,通过使用参数作为输入来执行两个命令,一个用于CSS,一个用于JS。

您可以使用apacheant和YUI Compressor来设置自己的构建过程。您可以用一个命令缩小所有JS和CSS文件


编辑:如果您想要一个示例项目,请尝试H5bp的ant构建脚本

我知道这是一个老生常谈的问题,但对于那些通过谷歌来到这里的人来说。你可以很容易地使用指南针

compass compile --output-style compressed --force

更多信息:

YUI Compressor在任何Ubuntu版本中都以软件包的形式提供

apt-get install yui-compressor

希望它能帮助

使用ACCSS进行css压缩,它的压缩率比YUI压缩机好,而且它是用c编写的,安装了automake,因此它几乎可以移植到所有系统

如上所述,您可以使用shell脚本来组合less和access。accss支持从stdin读取,因此您可以将它们与

lessc styles.less | accss>out.css

它还具有多种兼容性选项,特别是对于Internet Explorer


是的,YUI压缩机在各地都能正常工作(Linux、Mac..)