lesscss-maven-plugin icon indicating copy to clipboard operation
lesscss-maven-plugin copied to clipboard

Replace less files by css in html files

Open maximenowak opened this issue 13 years ago • 1 comments

Hi Marcel,

Thanks for work.

Using the plugin I have found something which could be great to add to your plugin, replacing in html files the less stylesheets by the new css ones generated.

Maybe other people have the same need ?

What do you think about it ?

Regards,

Maxime

maximenowak avatar Nov 17 '12 15:11 maximenowak

I had the same need ^^ I'm calling compile goal during generate-resources phase, and then altering the html files in process-resources phase, via ant:

<echo>Replacing .less imports by .css imports</echo>
<replace dir="${outputDirectory}" summary="true" token=".less" value=".css">
  <include name="**/*.htm*" />
</replace>
<replace dir="${outputDirectory}" summary="true" token="stylesheet/less" value="stylesheet">
  <include name="**/*.htm*" />
</replace>

<echo>Removing less.js import</echo>
<replaceregexp match="&lt;script.*less.js.*&lt;/script&gt;" replace="">
  <fileset dir="${outputDirectory}">
    <include name="**/*.htm*" />
  </fileset>
</replaceregexp>

Seems like a standard processing when you want to work in browser mode during development and switch to compile mode during build. Maybe it could be handled by another goal of the plugin ?

rquinio avatar Dec 11 '12 21:12 rquinio