Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #56 from rolos79/master

Adding LESS CSS to build script
  • Loading branch information...
commit b4615f5982407d716bbba7b4d0cb1b61177578c1 2 parents ff45c0b + 844bcf7
@roblarsen roblarsen authored
View
41 build.xml
@@ -661,6 +661,21 @@
replace="<link\1href='\2/${css.sha}.css'\3" flags="m">
<fileset dir="${dir.intermediate}" includes="${page-files}"/>
</replaceregexp>
+
+ <!-- Tidy up HTML when compiling LESS -->
+ <if>
+ <equals arg1="${build.css.less}" arg2="true"/>
+ <then>
+ <echo message="Removing LESS CSS Script from HTML..."/>
+ <replaceregexp match="&lt;!-- less script [\d\w\s\W]* end less script --&gt;" replace="">
+ <fileset dir="${dir.intermediate}" includes="${page-files}"/>
+ </replaceregexp>
+ <echo message="Changing rel attribute to 'stylesheet' from 'stylesheet/less'"/>
+ <replaceregexp match="rel=['&quot;]stylesheet/less['&quot;]" replace="rel='stylesheet'">
+ <fileset dir="${dir.intermediate}" includes="${page-files}"/>
+ </replaceregexp>
+ </then>
+ </if>
<foreach list="${file.stylesheets}" param="css_file" target="-css-remove-concatenated-stylesheets" />
@@ -922,6 +937,19 @@
</if>
</sequential>
</for>
+
+ <if>
+ <equals arg1="${build.css.less}" arg2="true"/>
+ <then>
+ <echo message="Processing LESS CSS..."/>
+ <lessjs input="${dir.intermediate}/${dir.css}/style-concat.css" output="${dir.intermediate}/${dir.css}/style-concat.css" />
+ </then>
+ <else>
+ <echo message="NOT Processing LESS CSS"/>
+ </else>
+ </if>
+
+
<echo message="Minifying css..."/>
<apply executable="java" parallel="false">
@@ -1089,7 +1117,18 @@
</apply>
</target>
-
+ <macrodef name="lessjs">
+ <attribute name="input" />
+ <attribute name="output" />
+ <sequential>
+ <java jar="./${dir.build.tools}/${tool.rhino}" fork="true" output="@{output}">
+ <arg path="./${dir.build.tools}/${tool.lesscss}" />
+ <arg path="@{input}" />
+ </java>
+ <echo>Lessjs: generated @{output}</echo>
+ </sequential>
+ </macrodef>
+
<!-- Import project.xml (put any custom build targets in this file so that they aren't overwritten when build.xml is updated) -->
<!-- See: https://github.com/h5bp/html5-boilerplate/issues/704 for discussion of the original pull request-->
<import file="./project.xml" />
View
7 config/default.properties
@@ -28,7 +28,6 @@ slug.modules = modules
dir.css = css
dir.images = img
-
#
# HTML, PHP, etc files to clean and update script/css references
#
@@ -79,6 +78,11 @@ file.root.script = main.js
file.root.stylesheet = style.css
#
+# Defaults to not processing LESS CSS (http://lesscss.org)
+#
+build.css.less = false
+
+#
# Default Stylesheet
#
file.default.stylesheets =
@@ -119,6 +123,7 @@ tool.rhino = rhino.jar
tool.jslint = fulljslint.js
tool.jshint = fulljshint.js
tool.csslint = csslint-rhino.js
+tool.lesscss = less-rhino-1.3.0.js
# Default Lint Utils Options
tool.jshint.opts = maxerr=25,eqeqeq=true
View
11 config/project.properties
@@ -17,6 +17,17 @@
#
file.stylesheets =
+#
+# LESS CSS Processing (http://lesscss.org)
+#
+# You must tell the script if you want to process your CSS as LESS
+# build.css.less = true
+#
+# You must also set your LESS css file as the root CSS file
+#
+# Example:
+# file.root.stylesheet = style.less
+#
# Web Pages
#
View
1  readme.md
@@ -21,6 +21,7 @@ Faster page load times and happy end users :)
* Updates your HTML to use the minified jQuery instead of the development version
* Remove unneeded references from HTML (like a root folder favicon)
* Runs your JavaScript through a code quality tool (optional)
+* Optionally precompile LESS formatted CSS
<img src="http://html5boilerplate.com/img/chart.png">
View
3,150 tools/less-rhino-1.3.0.js
3,150 additions, 0 deletions not shown
Please sign in to comment.
Something went wrong with that request. Please try again.