我正在MAMP上使用grunt-uncss和一个WordPress站点。我把我所有的css文件都合并成了一个文件。Grunt Uncss PhantomJS Wordpress ReferenceError:无法找到变量:JQuery
结果:一个网址需要40分钟才能完成。这不是有效的。另外,uncss只是吐出与之前相同的css。
许多错误是“ReferenceError:无法找到变量:jQuery”,但它像PhantomJS/UnCSS试图解析内联JavaScript?
下面是一些其它:
语法错误:意外标记 '%'
本地:193 setContent :2 语法错误:在标识符无效的转义: '\'
本地:427在setContent :2 语法错误:意外令牌 '<'
地方:891 setContent :2 SyntaxError:意外的令牌','
我已经尝试了不同的方法,包括加载更多的时间(超时)jQuery加载等,以及goo'gling过去七个小时。我很确定问题出在PhantomJS上,但我不太熟悉它。寻找帮助
这里是我的gruntfile
module.exports = function(grunt) {
require('time-grunt')(grunt);
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
jshint: {
all: ['gruntfile.js']
},
exec: {
get_grunt_sitemap: {
command: 'curl --silent --output sitemap.json http://localhost:8888/applus/?show_sitemap'
}
},
uncss: {
dist: {
options: {
ignore : [
/expanded/,
/js/,
/wp-/,
/align/,
/admin-bar/,
/\w\.in/,
".fade",
".collapse",
".collapsing",
/(#|\.)navbar(\-[a-zA-Z]+)?/,
/(#|\.)dropdown(\-[a-zA-Z]+)?/,
/(#|\.)(open)/,
".modal",
".modal.fade.in",
".modal-dialog",
".modal-document",
".modal-scrollbar-measure",
".modal-backdrop.fade",
".modal-backdrop.in",
".modal.fade.modal-dialog",
".modal.in.modal-dialog",
".modal-open",
".in",
".modal-backdrop",
'.hidden-xs',
'hidden-sm'
],
stylesheets : ['wp-content/themes/vest/css/consolidated.css'],
ignoreSheets : [/fonts.googleapis/],
urls : [], //Overwritten in load_sitemap_and_uncss task
},
files: {
'wp-content/themes/vest/style.test.css': ['**/*.php']
}
}
}
});
// 3. Where we tell Grunt we plan to use this plug-in.
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-uncss');
// 4. Where we tell Grunt what to do when we type "grunt" into the terminal.
grunt.registerTask('load_sitemap_json', function() {
var sitemap_urls = grunt.file.readJSON('./sitemap.json');
grunt.config.set('uncss.dist.options.urls', sitemap_urls);
});
grunt.registerTask('deploy'['jshint','exec:get_grunt_sitemap','load_sitemap_json','uncss:dist']);
};