【问题标题】:grunt-ngdocs: styles file not included to demo codegrunt-ngdocs:样式文件不包含在演示代码中
【发布时间】:2015-10-21 13:18:00
【问题描述】:

我正在使用grunt-ngdocs 来记录我的 Angular 项目。但演示 Plunker 代码(自动生成)不包含 CSS 文件。

我在Gruntfile.js中的配置包括:

...
scripts: [
    'https://code.jquery.com/jquery-2.1.4.js'
],
styles: [
    'https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.0.7/semantic.css'
]
...

在我的 JS src 文件中:

@example
    <example module="sui.checkbox">
        <file name="index.html">
        ...
        </file>
    <example>

在 API 页面上,JS 和 CSS 文件已正确加载。但是显示的 demo 源代码不包含 CSS 文件:

<!doctype html>
<html ng-app="sui.checkbox">
  <head>
    <script src="https://code.jquery.com/jquery-2.1.4.js"></script>
    <script src="app.js"></script>
    <!-- semantic.css should be imported here -->
  </head>
  <body>
    ...
  </body>
</html>

在我的 API 页面上,演示运行良好。但是链接到 Plunker 不会产生预期的结果,因为不存在包含行的 CSS。有什么建议吗?

【问题讨论】:

    标签: ngdoc grunt-ngdocs


    【解决方案1】:

    使用临时解决方案。在 inside javascript 文件 @example 部分添加以下行:

    <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.0.7/semantic.css">
    

    【讨论】:

    • 这个解决方案对我不起作用。当 css 被加载时,它会冻结浏览器。我尝试使用 Mozilla 和 chrome,但都冻结了
    猜你喜欢
    • 2016-02-05
    • 2010-12-13
    • 1970-01-01
    • 2021-10-05
    • 1970-01-01
    • 2014-01-02
    • 1970-01-01
    • 2014-11-19
    • 2017-12-22
    相关资源
    最近更新 更多