javascript - grunt build 出现 "Broken @import"错误?

标签 javascript css angularjs gruntjs yeoman

我正在尝试构建我的第一个 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/

相关文章:

javascript - 如何使用 ul 选择下拉列表的值

html - 防止 SVG 背景图像缩放

html - 启用或禁用输入文件时从 CSS 更改标签颜色

html - center absolutely positioned <a> 到绝对定位的图像

javascript - 如何使用 ng-repeat 和 ng-model 将动态值绑定(bind)到输入?

javascript - 我必须点击按钮两次才能添加评论

javascript - 居中未知大小的绝对定位图像

javascript - 我可以让 Vue.js 跨站点保持事件状态吗?

JavaScript - Math.floor(Math.random()) - 重新定位 <img> 元素

javascript - 在继续 $.each 函数中的下一个循环之前等待函数完成