我正在尝试构建我的第一个 Angular 应用程序。我正在使用 yeoman 和 Angular 生成器。该应用程序在“grunt serve”下运行良好,但是当我运行“grunt build”时,该过程因错误而停止 -
Running "cssmin:generated" (cssmin) task
Warning: Broken @import declaration of "" Use --force to continue.
Aborted due to warnings.
我不确定这个错误的原因是什么。我到处都看过但找不到解决方案。 这是 css 链接 -
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/animate.css/animate.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Bungee|Carrois+Gothic+SC|Oswald" rel="stylesheet">
<base href="/">
<!-- endbuild -->
最佳答案
我发现了错误,我只需要更改链接标签的位置。 应该是——
<!-- build:css(.) styles/vendor.css -->
<!-- bower:css -->
<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.css" />
<link rel="stylesheet" href="bower_components/animate.css/animate.css" />
<!-- endbower -->
<!-- endbuild -->
<!-- build:css(.tmp) styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Bungee|Carrois+Gothic+SC|Oswald" rel="stylesheet">
<base href="/">
现在grunt build
运行良好。所以只有 main.css 文件必须放在 <!-- build:css(.tmp) styles/main.css -->
之间和 <!-- endbuild -->
关于javascript - grunt build 出现 "Broken @import"错误?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38396038/