NetBeans Forums

 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister   ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
  

Minifying a JavaScript file during the build process.

 
Post new topic   Reply to topic    NetBeans Forums -> Web Client Users
View previous topic :: View next topic  
Author Message
negora



Joined: 06 Sep 2012
Posts: 25

PostPosted: Fri Dec 19, 2014 3:26 pm    Post subject: Minifying a JavaScript file during the build process. Reply with quote

Hello:

I've just tested the plug-in called JS CSS Minify Compress. I like the work that it does, but I would prefer that it minified the files during the build process, in the "build" directory, instead of creating new files in my project's directory. Is it possible to do so? How?

In case that it's not possible, Do you know of any other plug-in that does exactly that?

In this article of DZone, I've read that you can edit the "build.xml" file of your project to add an Ant task that calls YUI Compressor. I'm going to try it now, but I would prefer to have a plug-in that automated this task for all my projects... Although it's already time to put my hands on Ant after so many years using it transparently, he he he.

Thank you for your help!
Back to top
vriha



Joined: 07 Feb 2013
Posts: 135

PostPosted: Mon Dec 22, 2014 1:34 pm    Post subject: Minifying a JavaScript file during the build process. Reply with quote

I'd recommend using Grunt/Gulp for that. It is like "Ant for Web".
Stable NetBeans supports Grunt without any plugin needed, Dev builds
have also Gulp support. For Grunt, have a look at [1] and plugin for
minifying sources at [2]. It is very simple, create Gruntfile.js file,
define your tasks and you can (for HTML5 project) map any Grunt task to
clean/build/clean&build actions.

[1] http://gruntjs.com/
[2] https://github.com/gruntjs/grunt-contrib-uglify


Lada

On 12/19/2014 04:26 PM, negora wrote:
Quote:
Hello:

I've just tested the plug-in called JS CSS Minify Compress. I like the work that it does, but I would prefer that it minified the files during the build process, in the "build" directory, instead of creating new files in my project's directory. Is it possible to do so? How?

In case that it's not possible, Do you know of any other plug-in that does exactly that?

In this article of DZone (http://netbeans.dzone.com/announcements/minified-javascriptcss-builds), I've read that you can edit the "build.xml" file of your project to add an Ant task that calls YUI Compressor. I'm going to try it now, but I would prefer to have a plug-in that automated this task for all my projects... Although it's already time to put my hands on Ant after so many years using it transparently, he he he.

Thank you for your help!



Back to top
negora



Joined: 06 Sep 2012
Posts: 25

PostPosted: Tue Jan 27, 2015 3:52 pm    Post subject: Reply with quote

Hello Lada:

I'm sorry but I thought that I answered you the first time that I read your message :/ . I just wanted to thank you for the links.

Finally I decided to use the YUI Compressor plus the Ant task that I mentioned. It was a good decision, because it forced me to learn the basics about Ant. And it was really useful indeed.

Anyway, I took a look at Grunt and I may use it in the future. So thank you!
Back to top
tonytong



Joined: 17 Dec 2015
Posts: 1

PostPosted: Tue Dec 22, 2015 9:01 am    Post subject: Re: Minifying a JavaScript file during the build process. Reply with quote

vriha wrote:
I'd recommend using Grunt/Gulp for that. It is like "Ant for Web".
Stable NetBeans supports Grunt without any plugin needed, Dev builds
have also Gulp support. For Grunt, have a look at [1] and plugin for
minifying js sources at [2]. It is very simple, create Gruntfile.js file,
define your tasks and you can (for HTML5 project) map any Grunt task to
clean/build/clean&build actions.

[1] http://gruntjs.com/
[2] https://github.com/gruntjs/grunt-contrib-uglify



thanks vriha, I use the grunt plugin, it's good to use.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    NetBeans Forums -> Web Client Users All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum


Powered by phpBB
By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo