Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/aarnott/javascriptcsspackertargets
An MSBuild-based .targets file and task assembly for minifying js and css embedded resources
https://github.com/aarnott/javascriptcsspackertargets
Last synced: 7 days ago
JSON representation
An MSBuild-based .targets file and task assembly for minifying js and css embedded resources
- Host: GitHub
- URL: https://github.com/aarnott/javascriptcsspackertargets
- Owner: AArnott
- License: other
- Created: 2009-10-05T23:50:24.000Z (over 15 years ago)
- Default Branch: master
- Last Pushed: 2009-10-06T02:50:43.000Z (over 15 years ago)
- Last Synced: 2024-12-01T00:03:42.349Z (about 1 month ago)
- Language: C#
- Homepage: http://blog.nerdbank.net/
- Size: 89.8 KB
- Stars: 4
- Watchers: 5
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.txt
- License: LICENSE.txt
Awesome Lists containing this project
README
This .targets file and associated .dll file provide the means to minify your
C#/VB projects' embedded resources (.js and .css files).RELEASE NOTES: No .css minification is in place in this .targets file YET.
But there will be soon!== Applying automatic minification to your .js and .css embedded resources ==
To apply to your project, copy the JsCssMinification.targets and MinifierMsBuildTask.dll files
to the directory with your project in it or some common directory.add the following line just BELOW the last .targets import:
That's all you need to do. All EmbeddedResource .js items in your project
will automatically be minified in any build where $(Configuration) == 'Release'
or $(JsPack) == 'true'. It can be suppressed by setting $(JsPack) == 'false'.== PRESERVING COPYRIGHT NOTICES IN JAVASCRIPT FILES ==
Minification removes all comments in .js files. To keep a copyright notice at
the top of your .js file, you must add metadata to your EmbeddedResource item,
as shown here:
Copyright (c) 2009, Andrew Arnott. All rights reserved.
Code licensed under the Ms-PL License:
http://opensource.org/licenses/ms-pl.html
$(StandardCopyright)
== Javascript errors from minification ==
The Dean Edwards .js minifier is very aggressive (and thus very effective at
shrinking files). As a result, all semicolons are strictly required to be
after every statement. Missing semicolons will result in javascript errors
at runtime from browsers. If you find yourself getting these errors,
FireFox does a better job than IE at reporting exactly where the missing
semi-colon is.
You can read more about Javascript minification including less aggressive
algorithms here: http://developer.yahoo.com/yui/compressor/