This repository has been archived by the owner on Jun 10, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
86 lines (77 loc) · 2.44 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
module.exports = function(grunt) {
// Configuration
grunt.initConfig({
/*------- PackageJSON -------*/
pkg: grunt.file.readJSON('package.json'),
/*------- JS Hint -------*/
jshint: {
files: ['Gruntfile.js', 'src/**/*.js']
},
/*------- Clean -------*/
clean: ["dist/"],
/*------- RequireJS -------*/
requirejs: {
js: {
options: {
mainConfigFile: 'src/config.js',
// AMDClean for converting scripts into plain javascript
// files instead of including almond AMD loader.
onModuleBundleComplete: function (data) {
var version = grunt.config.data.pkg.version;
var fs = require('fs'),
amdclean = require('amdclean'),
outputFile = data.path;
fs.writeFileSync(outputFile, amdclean.clean({
'filePath': outputFile,
'transformAMDChecks': false,
'aggressiveOptimizations': false,
'createAnonymousAMDModule': true,
// Wrap library in an Immediately Invoked Function Expression (IIFE)
'wrap': {
'start': ';(function(window, document, navigator, undefined) {\nvar SEMANTICS={debug:true,version:"'+version+'"};\n',
'end': '\n}(typeof window !== "undefined" ? window : {}, typeof document !== "undefined" ? document : { createElement: function() {} }, typeof window !== "undefined" ? window.navigator : {}));'
},
'escodegen': { 'comment': false }
}));
}
}
}
},
/*------- Uglify -------*/
uglify: {
my_target: {
files: {
'dist/semantic.min.js': ['dist/semantic.js']
}
}
},
/*------- YuiDoc -------*/
yuidoc: {
compile: {
name: '<%= pkg.name %>',
description: '<%= pkg.description %>',
url: "http://semanticjs.oguzgelal.com",
logo: "http://i.imgur.com/dcLg0MG.png",
version: '<%= pkg.version %>',
options: {
paths: 'src/',
outdir: 'dist/docs'
}
}
}
});
// Load NPM Tasks
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-yuidoc');
// Default
grunt.registerTask('default', [
'clean',
'jshint',
'requirejs',
'uglify',
'yuidoc'
]);
};