Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6805187
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T19:33:23+00:00 2026-05-26T19:33:23+00:00

I want do compile all *.less scripts in a specific folder and it subdirs

  • 0

I want do compile all *.less scripts in a specific folder and it subdirs with less-rhino-1.1.3.js.

There is an example on github for doing this for a specific file, which works perfect. But I want to do the same for a complete folder. I tried a lot, here is my last try.

It doesn’t work, propertyregex seems not to be standard ANT, I don’t want to use such things. I am not even sure if this code would work.

<project name="test" default="main" basedir="../../">
<property name="css.dir" location="public/css"/>
<property name="tool.less" location="bin/less/less-rhino-1.1.3.js"/>
<property name="tool.rhino" location="bin/tools/rhino/js.jar"/>
<macrodef name="lessjs">
    <attribute name="input" />
    <attribute name="output" />
    <sequential>
        <java jar="${tool.rhino}" fork="true" output="@{output}">
            <arg path="${tool.less}"/>
            <arg path="@{input}"/>
        </java>
        <echo>Lessjs: generated @{output}</echo>
    </sequential>
</macrodef>

<target name="main">
     <echo>compiling less css</echo>
     <fileset dir="${css.dir}" id="myfile">
          <filename name="**/*.less" />
     </fileset>
     <property name="lessfilename" refid="myfile"/>
     <propertyregex property="cssfilename"
          input="${lessfile}"
          regexp="^(.*)\.less$"
          replace="^\1\.css$" 
          casesensitive="true" />
     <lessjs input="lessfile" output="cssfilename"/>
</target>
</project>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T19:33:23+00:00Added an answer on May 26, 2026 at 7:33 pm

    You could use the <fileset> to include all the less files need to be compiled. Later, you could use<mapper> to mark the corresponding detination css file.

    <project name="test" default="main" basedir="../../">
    <property name="css.dir" location="public/css"/>
    <property name="tool.less" location="bin/less/less-rhino-1.1.3.js"/>
    <property name="tool.rhino" location="bin/tools/rhino/js.jar"/>
    
      <target name="less" description="Convert LESS to CSS then concatenate and Minify any stylesheets">
    
      <echo message="Converting LESS to CSS..."/>
      <!-- Clear the former compiled css files -->
          <delete includeemptydirs="true">
                <fileset dir="${css.dir}" includes="*.css, **/*.css" defaultexcludes="false"/>
          </delete>
    
          <apply dir="${css.dir}" executable="java" parallel="false" failonerror="true">
      <!-- Give the input bundle of less files-->
              <fileset dir="${css.dir}">
                  <include name="*.less"/>
              </fileset>
              <arg value="-jar" />
              <arg path="${tool.rhino}" />
              <arg path="${tool.less}" />
              <srcfile/>
      <!-- Output the compiled css file with corresponding name -->
              <mapper type="glob" from="*.less" to="${css.dir}/*.css"/>
              <targetfile/>
          </apply>
    
      </target>
    
    </project>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have code that I want to compile on all unix systems, but if
When running an applications test suite I want to promote all Perl compile and
I want to compile a batch file into an EXE file using C++. I
I want to create a big file for all cool functions I find somehow
Let me start by example... I have an all.proj that looks similar to this:
when i want compile my app with the Distribution or Release method i get
I want to compile the following line of code from http://code.google.com/p/enhsim : enh::eout <<
I want to compile a project differently, according to a constant defined by #define,
I want to compile GCC and binutils which would produce 64bit executables. From GNU
I want to compile C code from the Command Prompt in Windows. I have

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.