Mercurial > nebulaweb3
comparison default/node_modules/tablesaw/Gruntfile.js @ 0:1d038bc9b3d2 default tip
Up:default
author | Liny <dev@neowd.com> |
---|---|
date | Sat, 31 May 2025 09:21:51 +0800 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:1d038bc9b3d2 |
---|---|
1 'use strict'; | |
2 | |
3 module.exports = function(grunt) { | |
4 | |
5 var jsFiles = [ | |
6 'src/tables.js', | |
7 'src/tables.stack.js', | |
8 'src/tables.btnmarkup.js', | |
9 'src/tables.columntoggle.js', | |
10 'src/tables.sortable.js', | |
11 'src/tables.swipetoggle.js', | |
12 'src/tables.minimap.js', | |
13 'src/tables.modeswitch.js', | |
14 'src/tables.checkall.js', | |
15 'src/tables.outro.js' | |
16 ]; | |
17 | |
18 var jsStackOnlyFiles = [ | |
19 'src/tables.js', | |
20 'src/tables.stack.js', | |
21 'src/tables.outro.js' | |
22 ]; | |
23 | |
24 // Project configuration. | |
25 grunt.initConfig({ | |
26 // Metadata. | |
27 pkg: grunt.file.readJSON('package.json'), | |
28 banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + | |
29 '<%= grunt.template.today("yyyy-mm-dd") %>\n' + | |
30 '<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' + | |
31 '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.company %>;' + | |
32 ' Licensed <%= pkg.license %> */\n', | |
33 // Task configuration. | |
34 clean: { | |
35 dependencies: ['dist/dependencies/'], | |
36 post: ['dist/tmp/', 'dist/**/*.min.*'] | |
37 }, | |
38 copy: { | |
39 jquery: { | |
40 src: 'node_modules/jquery/dist/jquery.js', | |
41 dest: 'dist/dependencies/jquery.js' | |
42 }, | |
43 naturalsort: { | |
44 src: 'node_modules/javascript-natural-sort/naturalSort.js', | |
45 dest: 'dist/dependencies/naturalsort.js' | |
46 }, | |
47 qunit: { | |
48 files: [{ | |
49 expand: true, | |
50 flatten: true, | |
51 src: [ 'node_modules/qunitjs/qunit/*' ], | |
52 dest: 'dist/dependencies/', | |
53 filter: 'isFile' | |
54 }] | |
55 } | |
56 }, | |
57 concat: { | |
58 options: { | |
59 banner: '<%= banner %>', | |
60 stripBanners: true | |
61 }, | |
62 jsautoinit: { | |
63 src: ['src/tables-init.js'], | |
64 dest: 'dist/<%= pkg.name %>-init.js' | |
65 }, | |
66 jsall: { | |
67 src: [ | |
68 'src/lib/shoestring-custom.js', | |
69 'src/tables.intro.shoestring.js' | |
70 ].concat( jsFiles ), | |
71 dest: 'dist/<%= pkg.name %>.js' | |
72 }, | |
73 jsjquery: { | |
74 src: [ | |
75 'src/tables.intro.jquery.js' | |
76 ].concat( jsFiles ), | |
77 dest: 'dist/<%= pkg.name %>.jquery.js' | |
78 }, | |
79 jsstack: { | |
80 src: [ | |
81 'src/lib/shoestring-custom.js', | |
82 'src/tables.intro.shoestring.js' | |
83 ].concat( jsStackOnlyFiles ), | |
84 dest: 'dist/stackonly/<%= pkg.name %>.stackonly.js' | |
85 }, | |
86 jsstackjquery: { | |
87 src: [ | |
88 'src/tables.intro.jquery.js' | |
89 ].concat( jsStackOnlyFiles ), | |
90 dest: 'dist/stackonly/<%= pkg.name %>.stackonly.jquery.js' | |
91 }, | |
92 cssall: { | |
93 src: [ | |
94 'src/tables.css', | |
95 'src/tables.toolbar.css', | |
96 'src/tables.skin.css', | |
97 'src/tables.stack.css', | |
98 'src/tables.stack-default-breakpoint.css', | |
99 'src/tables.swipetoggle.css', | |
100 'src/tables.columntoggle.css', | |
101 'src/tables.sortable.css', | |
102 'src/tables.minimap.css' | |
103 ], | |
104 dest: 'dist/tmp/<%= pkg.name %>.myth.css' | |
105 }, | |
106 cssstack: { | |
107 src: [ | |
108 'src/tables.css', | |
109 'src/tables.stack.css', | |
110 'src/tables.stack-default-breakpoint.css' | |
111 ], | |
112 dest: 'dist/tmp/<%= pkg.name %>.stackonly.myth.css' | |
113 }, | |
114 cssstackmixinpre: { | |
115 src: [ | |
116 'src/tables.css', | |
117 'src/tables.stack.css' | |
118 ], | |
119 dest: 'dist/tmp/<%= pkg.name %>.stackonly.myth.scss' | |
120 }, | |
121 cssstackmixinpost: { | |
122 src: [ | |
123 'dist/tmp/<%= pkg.name %>.stackonly-sans-mixin.scss', | |
124 'src/tables.stack-mixin.scss' | |
125 ], | |
126 dest: 'dist/stackonly/<%= pkg.name %>.stackonly.scss' | |
127 } | |
128 }, | |
129 qunit: { | |
130 files: ['test-qunit/**/*.html'] | |
131 }, | |
132 run: { | |
133 ava: { | |
134 exec: "./node_modules/.bin/ava" | |
135 } | |
136 }, | |
137 watch: { | |
138 src: { | |
139 files: [ | |
140 '<%= concat.jsall.src %>', | |
141 '<%= concat.jsautoinit.src %>', | |
142 '<%= concat.cssall.src %>' | |
143 ], | |
144 tasks: ['src'] | |
145 }, | |
146 test: { | |
147 files: ['dist/<%= pkg.name %>.js'], | |
148 tasks: ['test'] | |
149 } | |
150 }, | |
151 uglify: { | |
152 js: { | |
153 files: { | |
154 'dist/<%= pkg.name %>.min.js': [ 'dist/<%= pkg.name %>.js' ], | |
155 'dist/<%= pkg.name %>.jquery.min.js': [ 'dist/<%= pkg.name %>.jquery.js' ], | |
156 'dist/stackonly/<%= pkg.name %>.stackonly.min.js': [ 'dist/stackonly/<%= pkg.name %>.stackonly.js' ], | |
157 'dist/stackonly/<%= pkg.name %>.stackonly.jquery.min.js': [ 'dist/stackonly/<%= pkg.name %>.stackonly.jquery.js' ] | |
158 } | |
159 } | |
160 }, | |
161 cssmin: { | |
162 css: { | |
163 files: { | |
164 'dist/<%= pkg.name %>.min.css': [ 'dist/<%= pkg.name %>.css' ], | |
165 'dist/stackonly/<%= pkg.name %>.stackonly.min.css': [ 'dist/stackonly/<%= pkg.name %>.stackonly.css' ] | |
166 } | |
167 } | |
168 }, | |
169 bytesize: { | |
170 dist: { | |
171 src: [ | |
172 'dist/<%= pkg.name %>.min.css', | |
173 'dist/<%= pkg.name %>.min.js', | |
174 'dist/<%= pkg.name %>.jquery.min.js', | |
175 'dist/stackonly/<%= pkg.name %>.stackonly.min.css', | |
176 'dist/stackonly/<%= pkg.name %>.stackonly.min.js', | |
177 'dist/stackonly/<%= pkg.name %>.stackonly.jquery.min.js' | |
178 ] | |
179 } | |
180 }, | |
181 'gh-pages': { | |
182 options: {}, | |
183 src: ['dist/**/*', 'demo/**/*', 'test/**/*'] | |
184 }, | |
185 myth: { | |
186 dist: { | |
187 files: { | |
188 'dist/<%= pkg.name %>.css': '<%= concat.cssall.dest %>', | |
189 'dist/stackonly/<%= pkg.name %>.stackonly.css': '<%= concat.cssstack.dest %>', | |
190 'dist/tmp/<%= pkg.name %>.stackonly-sans-mixin.scss': '<%= concat.cssstackmixinpre.dest %>' | |
191 } | |
192 } | |
193 }, | |
194 compress: { | |
195 main: { | |
196 options: { | |
197 archive: 'dist/tablesaw-<%= pkg.version %>.zip', | |
198 mode: 'zip', | |
199 pretty: true | |
200 }, | |
201 files: [ | |
202 {expand: true, cwd: 'dist/', src: ['*'], dest: 'tablesaw/'}, | |
203 {expand: true, cwd: 'dist/', src: ['dependencies/*'], dest: 'tablesaw/'}, | |
204 {expand: true, cwd: 'dist/', src: ['stackonly/*'], dest: 'tablesaw/'} | |
205 ] | |
206 } | |
207 } | |
208 }); | |
209 | |
210 require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks); | |
211 | |
212 // Default task. | |
213 grunt.registerTask('test', ['qunit', 'run:ava']); | |
214 grunt.registerTask('concat-pre', ['concat:jsautoinit', 'concat:jsall', 'concat:jsjquery', 'concat:jsstack', 'concat:jsstackjquery', 'concat:cssall', 'concat:cssstack', 'concat:cssstackmixinpre']); | |
215 grunt.registerTask('concat-post', ['concat:cssstackmixinpost']); | |
216 grunt.registerTask('src', ['concat-pre', 'myth', 'concat-post', 'clean:dependencies', 'copy', 'clean:post']); | |
217 grunt.registerTask('filesize', ['uglify', 'cssmin', 'bytesize', 'clean:post']); | |
218 | |
219 grunt.registerTask('default', ['src', 'test', 'filesize']); | |
220 | |
221 // Deploy | |
222 grunt.registerTask('deploy', ['default', 'gh-pages']); | |
223 | |
224 }; |