mirror of
https://github.com/showdownjs/showdown.git
synced 2024-03-22 13:30:55 +08:00
47e26799f0
- build task now tests before building - removed build with closure task - test now runs lint before testing - Default grunt task is now build.
98 lines
2.9 KiB
JavaScript
98 lines
2.9 KiB
JavaScript
/**
|
|
* Created by Tivie on 12-11-2014.
|
|
*/
|
|
|
|
module.exports = function (grunt) {
|
|
|
|
// Project configuration.
|
|
grunt.initConfig({
|
|
pkg: grunt.file.readJSON('package.json'),
|
|
concat: {
|
|
options: {
|
|
separator: ';',
|
|
sourceMap: true
|
|
},
|
|
dist: {
|
|
src: ['src/showdown.js', 'src/*.js'],
|
|
dest: 'compressed/<%= pkg.name %>.js'
|
|
},
|
|
github_ext: {
|
|
src: ['src/extensions/github.js'],
|
|
dest: 'compressed/extensions/github.min.js'
|
|
},
|
|
prettify_ext: {
|
|
src: ['src/extensions/prettify.js'],
|
|
dest: 'compressed/extensions/prettify.min.js'
|
|
},
|
|
table_ext: {
|
|
src: ['src/extensions/table.js'],
|
|
dest: 'compressed/extensions/table.min.js'
|
|
},
|
|
twitter_ext: {
|
|
src: ['src/extensions/twitter.js'],
|
|
dest: 'compressed/extensions/twitter.min.js'
|
|
}
|
|
},
|
|
uglify: {
|
|
options: {
|
|
banner: '/*! <%= pkg.name %> <%= grunt.template.today("dd-mm-yyyy") %> */\n'
|
|
},
|
|
dist: {
|
|
files: {
|
|
'compressed/<%= pkg.name %>.min.js': ['<%= concat.dist.dest %>']
|
|
}
|
|
},
|
|
github_ext: {
|
|
files: {
|
|
'compressed/extensions/github.min.js': ['<%= concat.github_ext.dest %>']
|
|
}
|
|
},
|
|
prettify_ext: {
|
|
files: {
|
|
'compressed/extensions/prettify.min.js': ['<%= concat.prettify_ext.dest %>']
|
|
}
|
|
},
|
|
table_ext: {
|
|
files: {
|
|
'compressed/extensions/table.min.js': ['<%= concat.table_ext.dest %>']
|
|
}
|
|
},
|
|
twitter_ext: {
|
|
files: {
|
|
'compressed/extensions/twitter.min.js': ['<%= concat.twitter_ext.dest %>']
|
|
}
|
|
}
|
|
},
|
|
jshint: {
|
|
files: ['Gruntfile.js', 'src/**/*.js', 'test/**/*.js']
|
|
},
|
|
simplemocha: {
|
|
all: {
|
|
src: 'test/run.js',
|
|
options: {
|
|
globals: ['should'],
|
|
timeout: 3000,
|
|
ignoreLeaks: false,
|
|
ui: 'bdd'
|
|
}
|
|
}
|
|
}
|
|
});
|
|
|
|
grunt.loadNpmTasks('grunt-contrib-concat');
|
|
grunt.loadNpmTasks('grunt-contrib-uglify');
|
|
grunt.loadNpmTasks('grunt-contrib-jshint');
|
|
grunt.loadNpmTasks('grunt-simple-mocha');
|
|
|
|
// test
|
|
grunt.registerTask('lint', ['jshint']);
|
|
grunt.registerTask('test', ['concat', 'lint', 'simplemocha']);
|
|
|
|
// build with uglify
|
|
grunt.registerTask('build', ['test', 'concat', 'uglify']);
|
|
|
|
// Default task(s).
|
|
grunt.registerTask('default', ['build']);
|
|
|
|
};
|