gpt4 book ai didi

node.js - Grunt-usemin 和 revved 文件 - dirs 选项

转载 作者:搜寻专家 更新时间:2023-10-31 23:55:12 25 4
gpt4 key购买 nike

我对 grunt-usemin 插件有问题。

基本上,我想将所有静态内容放在 appdist 下的 static/ 目录中(取决于应用程序是构建的还是不是)。

现在,这是我的 grunt 配置

useminPrepare: {
html: ['<%= yeoman.app %>/app.html', '<%= yeoman.app %>/login.html'],
options: {
dest: '<%= yeoman.dist %>/static'
}
},
usemin: {
html: ['<%= yeoman.dist %>/{,*/}*.html'],
css: ['<%= yeoman.dist %>/static/styles/**/*.css'],
options: {
dirs: ['dist/static/']
}
}

第一部分没问题看输出

Found a block:
<!-- build:css(.tmp) login/styles/main.css -->
<link rel="stylesheet" href="styles/bootstrap.css">
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
Updating config with the following assets:
- .tmp/styles/bootstrap.css
- .tmp/styles/main.css

Found a block:
<!-- build:js({app/static}) login/scripts/libs.js -->
<script src="bower_components/angular/angular.js"></script>
<!-- endbuild -->
Updating config with the following assets:
- {app/static}/bower_components/angular/angular.js

Found a block:
<!-- build:js({.tmp,app/static}) login/scripts/scripts.js -->
<script src="scripts/loginApp.js"></script>
<script src="scripts/controllers/login.js"></script>
<!-- endbuild -->
Updating config with the following assets:
- {.tmp,app/static}/scripts/loginApp.js
- {.tmp,app/static}/scripts/controllers/login.js

Configuration is now:

cssmin:
{ 'dist/static/login/styles/main.css': 'dist/static/login/styles/main.css' }

concat:
{ 'dist/static/login/styles/main.css':
[ '.tmp/styles/bootstrap.css',
'.tmp/styles/main.css' ],
'dist/static/login/scripts/libs.js': [ '{app/static}/bower_components/angular/angular.js' ],
'dist/static/login/scripts/scripts.js':
[ '{.tmp,app/static}/scripts/loginApp.js',
'{.tmp,app/static}/scripts/controllers/login.js' ] }

uglify:
{ 'dist/static/login/scripts/libs.js': 'dist/static/login/scripts/libs.js',
'dist/static/login/scripts/scripts.js': 'dist/static/login/scripts/scripts.js' }

requirejs:
{}

但问题在于将普通文件与其更新版本交换,例如,这是使用挖矿之前的 html:

<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Login</title>
<meta name="viewport" content="width=device-width">
<!-- build:css(.tmp) login/styles/main.css -->
<link rel="stylesheet" href="styles/bootstrap.css">
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
</head>
<body ng-app="jsLinkedinConnectorLoginApp">
<div class="container" ng-view=""></div>

<!-- build:js({app/static}) login/scripts/libs.js -->
<script src="bower_components/angular/angular.js"></script>
<!-- endbuild -->

<!-- build:js({.tmp,app/static}) login/scripts/scripts.js -->
<script src="scripts/loginApp.js"></script>
<script src="scripts/controllers/login.js"></script>
<!-- endbuild -->
</body>
</html>

及之后:

<!doctype html>
<html class="no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>Login</title>
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="login/styles/main.css">
</head>
<body ng-app="jsLinkedinConnectorLoginApp">
<div class="container" ng-view=""></div>

<script src="login/scripts/libs.js"></script>

<script src="login/scripts/scripts.js"></script>
</body>
</html>

所以它几乎是正确的,似乎 grunt 没有在 dist/static 目录中获取 revved 文件。

现在,当我将例如 dist/static/login 目录向上移动到 dist/login 并将 dirs 更改为 dist 一切正常,因此将子目录提供给 dist 似乎会导致问题。

最佳答案

我通过更新 grunt-usemin 解决了我的问题插件到 2.0.0版本和切换 dirs属性(property)assetsDirs .

关于node.js - Grunt-usemin 和 revved 文件 - dirs 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19820494/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com