Skip to content

Commit

Permalink
6.4.8 回退到分割前的 6.4.6 版本并稍微修正
Browse files Browse the repository at this point in the history
This reverts commit 3a90ec8.

Conflicts:
	Super_preloaderPlus/package.json
	Super_preloaderPlus/src/main.js
	Super_preloaderPlus/src/rule.js
  • Loading branch information
ywzhaiqi committed Nov 17, 2014
1 parent bcb65d5 commit d8ab50e
Show file tree
Hide file tree
Showing 11 changed files with 5,912 additions and 6,135 deletions.
111 changes: 62 additions & 49 deletions Super_preloaderPlus/Gruntfile.js
Original file line number Diff line number Diff line change
@@ -1,51 +1,64 @@
module.exports = function(grunt) {

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
dist: {
options: {
banner: '(function() {\n',
footer: '\n})();',
separator: '\n\n',
process: true
},
src: [
'src/meta.js', 'src/rule.js', 'src/libs.js',
'src/FloatWindow.js', 'src/prefetcher.js', 'src/autopager.js',
'src/setting.js', 'src/main.js'
],
dest: '<%= pkg.name %>.user.js'
},
},
jshint: {
beforeconcat: ['gruntfile.js', 'src/*.js'],
afterconcat: ['<%= pkg.name %>.user.js'],
options: {
'browser': true,
'multistr': true,
'evil': true,
'globals': {
'GM_addStyle': true,
'GM_getValue': true,
'GM_setValue': true,
'GM_xmlhttpRequest': true,
'GM_openInTab': true,
'GM_setClipboard': true,
'GM_registerMenuCommand': true
}
}
},
watch: {
files: ['src/**/*.js'],
tasks: [ 'jshint', 'concat']
}
});

grunt.registerTask('default', ['jshint', 'concat', 'watch']);

grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');

};
var concatOptions = {
banner: '(function() {\n',
footer: '\n})();',
separator: '\n\n//----------------------------------\n',
process: true
};

grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
concat: {
dist: {
options: concatOptions,
src: ['src/meta.js', 'src/rule.js', 'src/main.js'],
dest: '<%= pkg.name %>.user.js'
},
},
watch: {
files: ['src/**/*.js'],
tasks: ['default']
}
})


grunt.registerTask('split', 'split file', function () {
grunt.file.expand('src/*').forEach(function(path){
grunt.file.delete(path);
});

var source = grunt.file.read('super_preloaderplus_one.user.js');

// 去除首行和尾行
source = source.replace(/^\(function\(\).*/, '')
.replace(/\}\)\(\);$/, '');

var arr = source.split(/\n\/\/\-+/);

arr.forEach(function (text, index) {
if (index === 0) {
grunt.file.write('src/meta.js', text);
} else {
var match = text.match(/\n\/\/\s*(.*)/);
var name = match ? match[1] : ('split' + index + '.js' );
grunt.file.write('src/' + name, text);
}
});

// grunt.log.writeln();
});


grunt.registerTask('default', [
//'jshint',
'concat',
])

grunt.registerTask('watch', ['watch'])

grunt.loadNpmTasks('grunt-contrib-concat')
grunt.loadNpmTasks('grunt-contrib-clean')
grunt.loadNpmTasks('grunt-contrib-watch')

}
4 changes: 2 additions & 2 deletions Super_preloaderPlus/package.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"name": "Super_preloaderPlus_one",
"version": "6.4.7",
"version": "6.4.8",
"devDependencies": {
"grunt": "~0.4.5",
"grunt-contrib-concat": "~0.4.0",
"grunt-contrib-jshint": "^0.10.0",
"grunt-contrib-watch": "~0.6.1"
}
}
}
Loading

0 comments on commit d8ab50e

Please sign in to comment.