Skip to content

Commit 1588f47

Browse files
committed
Changed the build for the bookmarklet to avoid being aware of module definitions since it conflicts when module libraries or core browser support is available. The code would prefer to export itself as a module rather than to the global namespace which is what the bookmarklet requires to run correctly.
This resolves some issues reported in #192
1 parent 1eafba2 commit 1588f47

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Contrib/Build/header-bookmarklet.js

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
/**
2+
* +--------------------------------------------------------------------+
3+
* | This HTML_CodeSniffer file is Copyright (c) |
4+
* | Squiz Pty Ltd (ABN 77 084 670 600) |
5+
* +--------------------------------------------------------------------+
6+
* | IMPORTANT: Your use of this Software is subject to the terms of |
7+
* | the Licence provided in the file licence.txt. If you cannot find |
8+
* | this file please contact Squiz (www.squiz.com.au) so we may |
9+
* | provide you a copy. |
10+
* +--------------------------------------------------------------------+
11+
*
12+
*/
13+
(function (root, factory) {
14+
var exports = factory();
15+
for (var prop in exports) {
16+
root[prop] = exports[prop];
17+
}
18+
}(this, function () {
19+
var _global = {}

gruntfile.coffee

+3-3
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,9 @@ module.exports = (grunt)->
4040
'Contrib/PhantomJS/runner.js'
4141
'Auditor/HTMLCSAuditor.js'
4242
],
43-
beacon:
43+
bookmarklet:
4444
options:
45-
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n' + grunt.file.read('Contrib/Build/umd-header.js')
45+
banner: '/*! <%= pkg.name %> - v<%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n' + grunt.file.read('Contrib/Build/header-bookmarklet.js')
4646
footer: grunt.file.read('Contrib/Build/umd-footer.js')
4747
files:
4848
'build/HTMLCS.js': [
@@ -89,5 +89,5 @@ module.exports = (grunt)->
8989

9090
grunt.registerTask 'default', ['jshint']
9191
grunt.registerTask 'build', ['uglify:dist', 'copy:dist']
92-
grunt.registerTask 'build-beacon', ['uglify:beacon', 'copy:dist']
92+
grunt.registerTask 'build-bookmarklet', ['uglify:bookmarklet', 'copy:dist']
9393
grunt.registerTask 'build-debug', ['uglify:debug', 'copy:dist']

0 commit comments

Comments
 (0)