Html Grunt预处理器不工作
我正在用Grunt开发一个HTML5应用程序。我正在尝试在我的HTML上使用该任务。为了验证它是否有效,我将预处理任务设置如下:Html Grunt预处理器不工作,html,build,gruntjs,Html,Build,Gruntjs,我正在用Grunt开发一个HTML5应用程序。我正在尝试在我的HTML上使用该任务。为了验证它是否有效,我将预处理任务设置如下: module.exports = function(config) { return { dev: { cwd: 'build/temp', src: [ '**/*.css', '**/*.js',
module.exports = function(config) {
return {
dev: {
cwd: 'build/temp',
src: [
'**/*.css',
'**/*.js',
'index.html',
'app/**/*.html'
],
options: {
inline : true,
context: {
ENV: 'dev'
}
}
}
};
};
我有一个基本index.html文件,如下所示:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no, width=device-width">
<title>Test</title>
</head>
<body>
<!-- @exclude -->
<header>You're on dev!</header>
<!-- @endexclude -->
Welcome
</body>
</html>
我不能理解这个错误。错误显示找不到css/animations.css。但是,它在前面的文件列表中显示了它。我还确认了它在文件系统上
谁能告诉我我做错了什么 使用
cwd
时,需要设置expand:true
有关更多信息,请参阅
你的任务将是:
dev: {
expand: true,
cwd: 'build/temp',
src: [
'**/*.css',
'**/*.js',
'index.html',
'app/**/*.html'
],
options: {
inline : true,
context: {
ENV: 'dev'
}
}
}
谢谢你的回复。我补充说:是的。虽然任务已经超出了这一步,但我仍然有
您在开发中代码>在我的代码中。它实际上不是在处理。我不确定我做错了什么。我自己没有任何预处理经验,只是看到了扩展:true
位。如果我有时间的话,我会看看能不能找到什么。谢谢。我衷心感谢你的见解。我还在想办法。我还没有运气。如果我弄明白了,我会在这里发布一个回复。嗯,我没有让它工作。我决定改用grunt text replace
插件,现在一切正常。谢谢你的努力。
dev: {
expand: true,
cwd: 'build/temp',
src: [
'**/*.css',
'**/*.js',
'index.html',
'app/**/*.html'
],
options: {
inline : true,
context: {
ENV: 'dev'
}
}
}