davidB / yuicompressor-maven-plugin

maven's plugin to compress (Minify / Ofuscate / Aggregate) Javascript files and CSS files using YUI Compressor
http://davidb.github.io/yuicompressor-maven-plugin/
GNU Lesser General Public License v2.1
122 stars 48 forks source link

Add configuration option to generate per-file header for aggregations #70

Closed dlh3 closed 10 years ago

dlh3 commented 10 years ago

It would be nice to include an option for producing a filename header before each file in an aggregation. Our project is using the option in our dev settings to aggregate but not compress/munge the files. We hope to use the same property with another option that will aid in JS/CSS development by placing a filename header at the start of each aggregated file.

Example:

<aggregations>
    <aggregation>
        <includes>
            <include>**/A.css</include>
            <include>**/B.css</include>
            <include>**/C.css</include>
        </includes>
        <addFileHeaders>true</addFileHeaders>
        <output>${project.build.outputDirectory}/aggregated.css</output>
    </aggregation>
    <aggregation>
        <includes>
            <include>**/X.js</include>
            <include>**/Y.js</include>
            <include>**/Z.js</include>
        </includes>
        <addFileHeaders>true</addFileHeaders>
        <insertNewLine>true</insertNewLine>
        <output>${project.build.outputDirectory}/aggregated.js</output>
    </aggregation>
</aggregations>

Would produce:

/* A.css */.a>.contents {}
/* B.css */.b>.contents {}
/* C.css */.c>.contents {}
/** X.js */
var x = "contents";
/** Y.js */
var y = "contents";
/** Z.js */
var z = "contents";

And of course, the header could be created for minified files as well.

dlh3 commented 10 years ago

I will try to find the time to contribute with a pull request.

dlh3 commented 10 years ago

I'd like to come back to this and add a test, but I'd prefer to focus on issue #69 first. Will try to make time for the test later in the week.

dlh3 commented 10 years ago

On a related note, perhaps a source map enhancement would be desirable.

davidB commented 10 years ago

Hi,

Thanks for your contributions. Before merge, can you update/complete the documentation (src/site/xdoc/ ex_aggregation.xml) and include your name into the pom.xml as contributor ?

davidB commented 10 years ago

Append the description of the 2 issues #70 #69 in the documentation would be great.

davidB commented 10 years ago

Add the source map if you want, or have time for. I'll be please to accept. When you'll think the change are ready, I'll do the test and release (during WE).

On Tue, Jan 21, 2014 at 7:56 PM, Dave Hughes notifications@github.comwrote:

On a related note, perhaps a source map enhancement would be desirable.

— Reply to this email directly or view it on GitHubhttps://github.com/davidB/yuicompressor-maven-plugin/pull/70#issuecomment-32934551 .