我正在尝试为wordpress创建一些繁琐的任务。主题需要root-relative urls(通常由php处理)所以我试图使用usemin的备用搜索路径来创建url。它似乎打破了文件加速。目前的代码:
<!-- build:css(/assets/css/style.min.css) /wp-content/themes/ees-theme/assets/css/style.min.css -->
<link rel="stylesheet" href="<?php echo get_template_directory_uri(); ?>/assets/css/style.css">
<!-- endbuild -->
工作区:
<!-- build:css assets/css/style.min.css -->
<link rel="stylesheet" href="/assets/css/style.css">
<!-- endbuild -->
它转动文件没问题。不知道我做错了什么,虽然觉得它必须与文件路径有关。
我尝试过改变/添加路径(一段时间后很随意),看看是否有效。
这里是usemin / rev grunt代码:
useminPrepare: {
html: ['<%= paths.dist %>/header.php','<%= paths.dist %>/footer.php'],
options: {
dest: '<%= paths.dist %>',
flow: {
html: {
steps: {
js: ['concat', 'uglifyjs'],
css: ['concat', 'cssmin']
},
post: {}
}
}
}
},
filerev: {
dist: {
options: {
algorithm: 'sha1',
length: 3
},
src: ['<%= paths.dist %>/assets/**/*.*', '!<%= paths.dist %>/assets/**/*.php'],
}
},
usemin: {
html: [
//'<%= paths.dist %>/{,*/}*.php',
'<%= paths.dist %>/header.php'
],
css: ['<%= paths.dist %>/assets/css/{,*/}*.css'],
options: {
assetsDirs: [
'./<%= paths.dist %>/',
'./<%= paths.dist %>/assets/**/*.*'
],
}
},