Created
October 30, 2012 18:24
-
-
Save eduardolundgren/3982038 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0"?> | |
<project name="AlloySass" default="local" xmlns:antelope="antlib:ise.antelope.tasks"> | |
<basename property="ant.file.basename" file="${ant.file}" /> | |
<target name="build-ruby-gems"> | |
<if> | |
<not> | |
<available file="${project.dir}/lib/jruby.jar" /> | |
</not> | |
<then> | |
<get | |
dest="${project.dir}/lib/jruby.jar" | |
src="http://jruby.org.s3.amazonaws.com/downloads/1.6.5/jruby-complete-1.6.5.jar" | |
/> | |
</then> | |
</if> | |
<if> | |
<not> | |
<available file="${project.dir}/lib/ruby-gems.jar" /> | |
</not> | |
<then> | |
<tstamp> | |
<format property="tstamp.value" pattern="yyyyMMddkkmmssSSS" /> | |
</tstamp> | |
<java | |
fork="true" | |
jar="${project.dir}/lib/jruby.jar" | |
> | |
<arg line="-S gem install compass -i ./${tstamp.value}/output --no-rdoc --no-ri" /> | |
</java> | |
<jar | |
basedir="${tstamp.value}/output" | |
jarfile="${project.dir}/lib/ruby-gems.jar" | |
/> | |
<delete dir="${tstamp.value}" /> | |
</then> | |
</if> | |
</target> | |
<target name="sass-parse"> | |
<sass-parse /> | |
</target> | |
<macrodef name="sass-parse"> | |
<attribute name="folder.sass" default="${component.assets.base}" /> | |
<attribute name="folder.sass.backup" default="${component.basedir}/.sass-tmp" /> | |
<sequential> | |
<if> | |
<and> | |
<equals arg1="${ant.file.basename}" arg2="build.xml" /> | |
<available file="@{folder.sass}" type="dir" /> | |
</and> | |
<then> | |
<echo message="Parsing SASS" /> | |
<if> | |
<not> | |
<equals arg1="@{folder.sass.backup}" arg2="" /> | |
</not> | |
<then> | |
<copy todir="@{folder.sass.backup}" overwrite="true"> | |
<fileset dir="@{folder.sass}" /> | |
</copy> | |
</then> | |
</if> | |
<property name="file.path.pattern" value="@{folder.sass}/**/**.css" /> | |
<path id="jruby"> | |
<fileset file="${project.dir}/lib/jruby.jar"/> | |
<fileset file="${project.dir}/lib/ruby-gems.jar"/> | |
</path> | |
<script language="ruby" classpathref="jruby"> | |
<![CDATA[ | |
require 'rubygems' | |
require 'java' | |
require 'compass' | |
filePathPattern = $project.getProperty('file.path.pattern') | |
files = Dir.glob(filePathPattern) | |
Compass.add_project_configuration | |
load_paths = [] | |
load_paths += Compass.configuration.sass_load_paths | |
files.each do | file | | |
fileContent = File.read(file) | |
engine = Sass::Engine.new( | |
fileContent, | |
{ | |
:filename => file, | |
:syntax => :scss, | |
:load_paths => load_paths, | |
:ugly => true, | |
:style => :expanded | |
} | |
) | |
File.open(file, 'w') { |f| f.write(engine.render) } | |
end | |
]]> | |
</script> | |
</then> | |
</if> | |
</sequential> | |
</macrodef> | |
<target name="sass-postclean"> | |
<sass-postclean /> | |
</target> | |
<macrodef name="sass-postclean"> | |
<attribute name="folder.sass" default="${component.assets.base}" /> | |
<attribute name="folder.sass.backup" default="${component.basedir}/.sass-tmp" /> | |
<sequential> | |
<if> | |
<and> | |
<available file="@{folder.sass}" type="dir" /> | |
<equals arg1="${ant.file.basename}" arg2="build.xml" /> | |
</and> | |
<then> | |
<delete dir="@{folder.sass}" /> | |
<copy todir="@{folder.sass}" overwrite="true"> | |
<fileset dir="@{folder.sass.backup}" /> | |
</copy> | |
<delete dir="@{folder.sass.backup}" /> | |
</then> | |
</if> | |
</sequential> | |
</macrodef> | |
</project> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment