123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158 |
- /*
- * grunt-contrib-uglify
- * http://gruntjs.com/
- *
- * Copyright (c) 2012 "Cowboy" Ben Alman, contributors
- * Licensed under the MIT license.
- */
- 'use strict';
- module.exports = function(grunt) {
- // Project configuration.
- grunt.initConfig({
- jshint: {
- all: [
- 'Gruntfile.js',
- 'tasks/**/*.js',
- '<%= nodeunit.tests %>'
- ],
- options: {
- jshintrc: '.jshintrc'
- }
- },
- // Before generating any new files, remove any previously-created files.
- clean: {
- tests: ['tmp']
- },
- // Configuration to be run (and then tested).
- uglify: {
- compress: {
- files: {
- 'tmp/compress.js': ['test/fixtures/src/simple.js']
- },
- options: {
- mangle: false
- }
- },
- compress_mangle: {
- files: {
- 'tmp/compress_mangle.js': ['test/fixtures/src/simple.js']
- }
- },
- compress_mangle_except: {
- files: {
- 'tmp/compress_mangle_except.js': ['test/fixtures/src/simple.js']
- },
- options: {
- mangle: {
- except: ['argumentC']
- }
- }
- },
- compress_mangle_beautify: {
- files: {
- 'tmp/compress_mangle_beautify.js': ['test/fixtures/src/simple.js']
- },
- options: {
- beautify: true
- }
- },
- multifile: {
- files: {
- 'tmp/multifile.js': ['test/fixtures/src/simple.js','test/fixtures/src/comments.js']
- },
- options: {
- mangle: false
- }
- },
- compress_mangle_sourcemap: {
- files: {
- '/dev/null': ['test/fixtures/src/simple.js']
- },
- options: {
- sourceMap: 'tmp/compress_mangle_sourcemap'
- }
- },
- sourcemapin: {
- files: {
- 'tmp/sourcemapin.js': ['test/fixtures/src/simple2.js']
- },
- options: {
- mangle : false,
- sourceMap: 'tmp/sourcemapin',
- sourceMapIn: 'test/fixtures/src/simple2.map',
- sourceMapRoot: 'http://local.host/js/'
- }
- },
- sourcemapurl: {
- files: {
- 'tmp/sourcemapurl.js': ['test/fixtures/src/simple.js']
- },
- options: {
- sourceMappingURL: 'js/sourcemapurl.js.map'
- }
- },
- comments: {
- src: 'test/fixtures/src/comments.js',
- dest: 'tmp/comments.js',
- options: {
- mangle: false,
- preserveComments: 'some'
- }
- },
- wrap: {
- src: 'test/fixtures/src/simple.js',
- dest: 'tmp/wrap.js',
- options: {
- mangle: false,
- wrap: 'testExport'
- }
- },
- exportAll: {
- src: 'test/fixtures/src/simple.js',
- dest: 'tmp/exportAll.js',
- options: {
- mangle: false,
- wrap: 'testExport',
- exportAll: true
- }
- },
- sourcemap_prefix: {
- files: {
- '/dev/null': ['test/fixtures/src/simple.js']
- },
- options: {
- sourceMap: 'tmp/sourcemap_prefix',
- sourceMapPrefix: 3
- }
- }
- },
- // Unit tests.
- nodeunit: {
- tests: ['test/*_test.js']
- }
- });
- // Actually load this plugin's task(s).
- grunt.loadTasks('tasks');
- // These plugins provide necessary tasks.
- grunt.loadNpmTasks('grunt-contrib-jshint');
- grunt.loadNpmTasks('grunt-contrib-clean');
- grunt.loadNpmTasks('grunt-contrib-nodeunit');
- grunt.loadNpmTasks('grunt-contrib-internal');
- // Whenever the "test" task is run, first clean the "tmp" dir, then run this
- // plugin's task(s), then test the result.
- grunt.registerTask('test', ['clean', 'uglify', 'nodeunit']);
- // By default, lint and run all tests.
- grunt.registerTask('default', ['jshint', 'test', 'build-contrib']);
- };
|