grunt-ngdocs: styles file not included to demo code

牧云@^-^@ 提交于 2019-12-11 03:47:43

问题


I am using grunt-ngdocs to document my Angular project. But the demo Plunker code (generated automatically) doesn't include the CSS file.

My configuration in Gruntfile.js includes:

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

In my JS src file:

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

On the API page, the JS and CSS files are loaded correctly. However the displayed demo source code doesn't include the CSS file:

<!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>

On my API page, the demo works well. But linking to Plunker doesn't produce desired result, because the CSS including line is not there. Any suggestions?


回答1:


Use a temp solution. Add the following line inside the javascript files @example section:

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


来源:https://stackoverflow.com/questions/31719426/grunt-ngdocs-styles-file-not-included-to-demo-code

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!