Skip to content
This repository has been archived by the owner on Mar 23, 2022. It is now read-only.

Example about include only a few files and aggretate it into one file #32

Open
matienzar opened this issue Jul 26, 2011 · 3 comments
Open

Comments

@matienzar
Copy link

Hello,

I don't where to post it, and I post it to an issue.

I've several js files and I only need to compress and aggregate a few ones into a directory. What I've to do it?

I need to do something like this:

directory1

  • file1.js
  • file2.js
    directory2
    • file3.js
      directoryn
      -filen.js

I only need to compress and aggregate in a single file directory1

Lot of thanks,

Marcial

@davidB
Copy link
Owner

davidB commented Jul 27, 2011

You can exclude every directory2-n explicitly, but it could be tedious.
I suggest to move directory1 outside src/main/webapp (eg src/main/webapp-ext) and configure the plugin with

  <configuration>
      <warSourceDirectory>${basedir}/src/main/webapp-ext</warSourceDirectory>
      <aggregations>
        <aggregation>
          <removeIncluded>true</removeIncluded>
          <insertNewLine>true</insertNewLine>
          <output>${project.build.directory}/${project.build.finalName}/directory1/all.js</output>
          <includes>
            <include>**/*.js</include>
          </includes>
        </aggregation>
      </aggregations>
    </configuration>

see :

@matienzar
Copy link
Author

A good is to have an option to include a list of files and mantain the order. Example:

I only need this 3 files about 100 others:

file1js
file2.js
file3.js

file3.js depends on file1.js, file1.js in aggregate must be the first

@davidB
Copy link
Owner

davidB commented Jul 28, 2011

aggregation keep the ordre if you don't use wildcard

      <includes>
        <include>file1.js</include>
        <include>file2.js</include>
        <include>file3.js</include>
      </includes>

as a side note, I encourage you to take alook at js loader like head.js, LAB.js, requirejs,... to avoid aggregation and order constraint.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants