[ https://issues.apache.org/jira/browse/OFBIZ-11960?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17346971#comment-17346971 ] Aditya Sharma commented on OFBIZ-11960: --------------------------------------- Hi [~mbrohl], As explained in the description of plugin, it integrates Node.js based system with Gradle. Here is how we can benefit from it: 1. We have access to all the JavaScript packages that can be installed with npm or Yarn, so instead of adding JavaScript to OFBiz we can simply add a entry in [package.json|https://github.com/apache/ofbiz-framework/pull/230/files#diff-d99da454386376715bb13bf5c5c7f778a1aaefdc396c665e732d8287039e8cc2R7] and files will downloaded to user's system from the registry like the Gradle dependencies. 2. Minor updates can be handled implicity by node when specified with [tilde|https://github.com/npm/node-semver#tilde-ranges-123-12-1] range or [caret|https://github.com/npm/node-semver#caret-ranges-123-025-004] range for version. For major updates, we just have to change the version and use npm install. No explicit download thus making upgrade process quite easy. 3. Currently, we use non minified versions of JavaScript & CSS files with custom code. We can use task runner libraries like Gulp or Grunt to automate minification. Similarly, we can merge all the JavaScript libraries into single file and use. This will give optimised performance to page load as JS file size will be reduced along with reduction to no of resource calls (in a way reducing the server load too). 4. With time JavaScript has evolved, introduction to ES6 (ECMAScript 2015) brought great capabilites to write complex modularized code. We would be able to add code as per the new standards that can be easily transpiled with available npm utilities. With this MR, I have added JQuery, jQuery browser and JQuery validate library only. Further I plan to implement logic to minify and merge the files. > Use NPM with gradle to get external JS dependencies > --------------------------------------------------- > > Key: OFBIZ-11960 > URL: https://issues.apache.org/jira/browse/OFBIZ-11960 > Project: OFBiz > Issue Type: New Feature > Components: ALL APPLICATIONS > Affects Versions: Trunk > Reporter: Aditya Sharma > Assignee: Aditya Sharma > Priority: Trivial > > As discussed [here|https://lists.apache.org/thread.html/re16808eb5b1084f822c74194d23ca073dea4f4df443184f40f5f58c6%40%3Cdev.ofbiz.apache.org%3E], use gradle-js-plugin to ease out managing the JavaScript dependencies. The Gradle plugin allows us to automatically download the js libraries to the user's system like the Gradle dependencies, so we no longer need to include them with the package. It opens door to all the packages and modules available at [npm registry|https://www.npmjs.com/]. Also, it can be clubbed with Grunt or Gulp implementing tasks to minify external JS and CSS files with the custom ones, see [here|https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/faq.md#how-do-i-run-commands-provided-by-npm-packages]. > 1. Add [gradle-node-plugin|https://github.com/node-gradle/gradle-node-plugin]: Gradle plugin for integrating NodeJS in your build > 2. Create [NPM|https://www.npmjs.com/] package.json with JS dependencies in webapp > 3. Use available tasks to install dependencies > [https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/usage.md#executing-npm-tasks] > [https://github.com/node-gradle/gradle-node-plugin/blob/master/docs/usage.md#configuring-the-plugin] > 4. Use the downloaded JS files in node_modules, updating the current path of the JS files. -- This message was sent by Atlassian Jira (v8.3.4#803005) |
Free forum by Nabble | Edit this page |