javascript - Where is the require.js file generated from? -
i learning angular 2 example https://github.com/pkaul/maven-typescript-example
so after run 3rd step (mvn jetty:run), runnable war folder packaged in example-webapp/target folder. however, there 1 file not sure about. under folder example-webapp/target/example-webapp-0.1.0-snapshot/modules, require.js file, old timestamp 2013-05-14.
i know comes , for. guessing file related requirejs-maven-plugin plugin defined in pom.xml inside example-webapp. standing confirmed or corrected.
<plugin> <groupid>com.github.mcheely</groupid> <artifactid>requirejs-maven-plugin</artifactid> <version>1.0.4</version> <executions> <execution> <phase>package</phase> <goals> <goal>optimize</goal> </goals> </execution> </executions> <configuration> <skip>true</skip><!-- not enabled default --> <configfile>${basedir}/src/build/js/optimize.js</configfile> <filterconfig>true</filterconfig> </configuration> </plugin>
the file require.js
being pulled maven dependency:
<dependency> <groupid>org.jszip.redist</groupid> <artifactid>require</artifactid> <version>2.1.6</version> <type>jszip</type> </dependency>
the project uses jszip-maven-plugin
handle javascript libraries if standard maven dependencies (like spring or else):
jszip's maven plugin used when want either create jszip modules or consume jszip modules in
war
project.
the big advantage of plugin instead of copying , downloading manually require.js
file , putting in correct place of webapp, makes build automatic , easying updates (you need update dependency). goes hand-to-hand maven dependency concept traditional java libraries.
the plugin download javascript libraries maven central jszip
, unpack them , put them configured:
<plugin> <groupid>org.jszip.maven</groupid> <artifactid>jszip-maven-plugin</artifactid> <extensions>true</extensions> <configuration> <mappings> <!-- copy jszip dependencies directory "modules" --> <mapping> <select>*:*</select> <path>modules</path> </mapping> </mappings> </configuration> <!-- --> </plugin>
in case, copied modules
directory, see output. <select>*:*</select>
means consider jszip
dependencies , <path>modules</path>
specifies output directory.
so actually, has nothing requirejs-maven-plugin
there optimize , compress javascript files.
Comments
Post a Comment