Skip to content

Commit 4e84762

Browse files
author
Rafael J. Staib
committed
Add regex replace to remove api comments from release file
1 parent 5776187 commit 4e84762

File tree

5 files changed

+157
-970
lines changed

5 files changed

+157
-970
lines changed

Gruntfile.js

+26-6
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ module.exports = function (grunt)
1010
concat: {
1111
options: {
1212
separator: '\r\n\r\n',
13-
banner: '/*! <%= "\\r\\n * " + pkg.name %> v<%= pkg.version %> - <%= grunt.template.today("mm/dd/yyyy") + "\\r\\n" %>' +
13+
banner: '/*! <%= "\\r\\n * " + pkg.title %> v<%= pkg.version %> - <%= grunt.template.today("mm/dd/yyyy") + "\\r\\n" %>' +
1414
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> <%= (pkg.homepage ? "(" + pkg.homepage + ")" : "") + "\\r\\n" %>' +
1515
' * Licensed under <%= pkg.licenses[0].type + " " + pkg.licenses[0].url + "\\r\\n */\\r\\n" %>' +
1616
';(function ($, undefined)\r\n{\r\n',
@@ -29,12 +29,31 @@ module.exports = function (grunt)
2929
}
3030
}
3131
},
32+
"regex-replace": {
33+
all: {
34+
src: ['<%= pkg.folders.dist %>/jquery.steps.js'],
35+
actions: [
36+
{
37+
name: 'multiLineComments',
38+
search: /\/\*[^!](.|\r|\n)*?\*\/\r\n?/gim,
39+
replace: ''
40+
},
41+
{
42+
name: 'singleLineComment',
43+
search: /^\s*?[^http:\/\/]\/\/.*\r\n?/gi,
44+
replace: ''
45+
},
46+
{
47+
name: 'singleLineCommentSameLine',
48+
search: /[^http:\/\/]\/\/.*/gi,
49+
replace: ''
50+
}
51+
]
52+
}
53+
},
3254
uglify: {
3355
options: {
34-
preserveComments: false,
35-
banner: '/*! <%= "\\r\\n * " + pkg.name %> v<%= pkg.version %> - <%= grunt.template.today("mm/dd/yyyy") + "\\r\\n" %>' +
36-
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %> <%= (pkg.homepage ? "(" + pkg.homepage + ")" : "") + "\\r\\n" %>' +
37-
' * Licensed under <%= pkg.licenses[0].type + " " + pkg.licenses[0].url + "\\r\\n */\\r\\n" %>',
56+
preserveComments: 'some',
3857
report: 'gzip'
3958
},
4059
all: {
@@ -121,9 +140,10 @@ module.exports = function (grunt)
121140
grunt.loadNpmTasks('grunt-contrib-concat');
122141
grunt.loadNpmTasks('grunt-contrib-yuidoc');
123142
grunt.loadNpmTasks('grunt-contrib-clean');
143+
grunt.loadNpmTasks('grunt-regex-replace');
124144

125145
grunt.registerTask('default', ['build']);
126146
grunt.registerTask('api', ['clean:api', 'yuidoc']);
127-
grunt.registerTask('build', ['clean:build', 'concat', 'jshint', 'qunit']);
147+
grunt.registerTask('build', ['clean:build', 'concat', 'regex-replace', 'jshint', 'qunit']);
128148
grunt.registerTask('release', ['build', 'api', 'uglify']);
129149
};

0 commit comments

Comments
 (0)