I'm looking for a visual studio plugin with the following functionality:
On building the project or executing the tool, the plugin looks for all *.js and *.css files in your project and compresses/minimizes them into *.min.js and *.min.css files.
Executing the tool on project build would enable you to keep the references to *.min.js in your pages while changes to the *.js files would be instantly written to the *.min.js files.
Is there such thing available?
If not what's the closest thing to automize tasks like that?
Extra question:
How about auto combining files?
Check out these two links:
An MS build script for YUI compressor
YUI compressor for VS
You probably be better off doing it with NAnt and coding it to run the compression. Automated process is always better than a manual one.
Web Essentials is best program for that, I really like it, and it has a lot of other nice features: http://vswebessentials.com/
Related
I'm doing a web based java application using Netbeans IDE, There are some javascript files in netbeans IDE. I need to Obfuscate or minify my javascript files automatically when I clean and build the project, Is there any solution for that? or do I need to write any build script , please provide me a solution
You can use gulp. Gulp has a great gulp-uglify plugin for that(https://www.npmjs.com/package/gulp-uglify).
If it's a simple website and you don't want to use advanced solutions like task runner (Gulp) you can simply use website like this one - https://jscompress.com/ - and minify your all files after your page is done.
For about 2 weeks i have been surfing the internet for finding any idea or a software to help me obfuscating my asp project i couldn't find any helpful way cause my main need is to obfuscate the .JS files in my project and i didn't find any build in tool for VS2010, cause i want to have an automated build including obfuscating however i have also tried searching a tool for javascript files obfuscating including a command line way to communicate with the tool so i can call it in pre build event.
also if you can explain for me how to handle the injected javascript code in my c# code or no need to do this step.
I really appreciate your helps.
Actually there is a plenty of different way to obfuscating javascript. One of the best solution is gulp
Gulp is a task/build runner for development. It allows you to do a lot of stuff within your development workflow. You can compile sass files, uglify and compress js files and much more. The kicker for gulp is that its a streaming build system which doesn't write temp files.
It's really usefull tool to static files management. I suggest you to dive into it.
For example; lets look at following gulp definitian.
elixir(function(mix) {
mix.styles([
"font.css",
"bootstrap.css",
"custom.css"
], 'public/css/production.css').
scripts([
"jquery-2.2.4.min.js",
"bootstrap.min.js",
"app.js"
], 'public/js/production.js')
});
It concatenates font.css, bootstrap.css and custom.css files in order. And same for js files.Then performs compression and obfuscation.
You just need to run gulp --production for that.
There is a very good detailed documentation about using gulp with asp.net.
https://docs.asp.net/en/latest/client-side/using-gulp.html
I have several backbone.js views, javascript modules and style sheets in an ASP.Net MVC app i'm developing. I want to seperate these files during development but combine/consolidate, compress, uglify, resolve dependencies etc. before deployment. The Ruby community has solutions for this including Juicer and Jammit. Are there similar solutions for .Net web developers ideally solutions that integrate with visual studio.
I've used Chirpy for this in the past. Also compiles SASS, LESS, and CoffeeScript.
We use YUI Builder for exactly this purpose. (We also happen to use YUI extensively in our products.) It's Java/Ant based, but it wasn't hard to get msbuild to do all the work by creating a project file (csproj in our case) and overriding the "build" target. We include the project in our main .sln file, and it automatically builds along with all of our C#/.NET projects.
One thing to watch out for: We initially got frequent/random "access denied" errors when building this way. It turns out that Visual Studio was locking many of the intermediate files that YUI Builder generates. So our workaround is to robocopy all the relevant files to a temp folder, do the work there, and robocopy them back.
It's not ideal, and certainly not an out-of-the-box integration like you're probably hoping for, but it works well for us. It gives us minification, JSLint checking, dependency management, and an infrastructure for serving one combined file rather than individual scripts.
What tools can minify JS/CSS files after saving files without using console? I want something like SimpLESS. Write and update some js and css files and they minify and concatenate in two "build" files like that daemon program do automatically with LESS.
For Windows: Smalify works for me, if I'm not using CoffeeScript. I haven't tried them, but there are several other CodeKit alternatives here.
You can always find a plugin for your Text Editor. I don't know which editor you are using, but most of the popular ones either have build systems, have strong plugin communities, or both.
Sublime Text 2: Tons of plugins, and you can customize a build and save script.
Notepad++: Vibrant community, has minification plugins that would work for you as well.
CodeKit for Mac.
Check this python script.
http://github.com/hkasera/minify
It minifies js as well as css files too. It stores detailed log files and you can add this script as a git hook and save yourself from doing it manually everytime.
Hope it may help!
I created a moduling system using jQuery. Is there any build system something similar to Dojo's Shrinksafe, that could combine all my module files into one single file for production?
Does YUI Compresser is all about single file compression or does it support bundling the module files as well? JavascriptMVC uses a custom build of Shrinksafe. Any links or info on that direction will also help. Thanks in advance.
RequireJS has an optimization tool that can combine multiple files together, and it uses Google's Closure Compiler to do JavaScript minification/comment stripping. The optimization tool was based on the work I did in the Dojo build system, but it is something that works more stand-alone.
Disclaimer: I develop RequireJS