fra*_*val 2 ruby eclipse ant sass batch-file
我有这个ANT任务在eclipse项目中执行Sass:
<project basedir="." default="sass">
<target name="sass">
<apply dest="www/styles" executable="sass">
<srcfile/>
<targetfile/>
<fileset dir="styles" includes="*.scss"/>
<mapper from="*.scss" to="*.css" type="glob"/>
</apply>
</target>
</project>
Run Code Online (Sandbox Code Playgroud)
它在Ubuntu中运行良好.在Windows 7中,我必须将可执行文件设置为sass.bat.
这是错误:
Buildfile: D:\my_workspace\my_project\build.xml
sass:
BUILD FAILED
D:\my_workspace\my_project\build.xml:3: Execute failed: java.io.IOException:
Cannot run program "sass" (in directory "D:\my_workspace\my_project"):
CreateProcess error=2, The system cannot find the file specified
Total time: 326 milliseconds
Run Code Online (Sandbox Code Playgroud)
可以从命令行调用sass和sass.bat,以便Ruby/bin文件夹位于系统PATH变量中.
我不想为不同的操作系统保留这个文件的两个版本.
我怎么解决这个问题?
我已通过添加条件变量解决了这个问题exec_file与值sass.bat的Windows系列操作系统和sass其他.
<project basedir="." default="sass">
<condition property="exec_file" value="sass.bat" else="sass" >
<os family="windows" />
</condition>
<target name="sass">
<apply dest="www/styles" executable="${exec_file}">
<srcfile/>
<targetfile/>
<fileset dir="styles" includes="*.scss"/>
<mapper from="*.scss" to="*.css" type="glob"/>
</apply>
</target>
</project>
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1926 次 |
| 最近记录: |