1

从 Gruntfile.js 中读取并包含提到的 css、js 文件。我尝试使用 grunt-include-source 插件但不工作

索引.html

<html>
<head>
  <!-- build:css <include destination file name> -->
    <---include the mentioned css files from Gruntfile.js--->
  <!-- endbuild -->

</html>

Gruntfile.js 中

files: {
                        '<%= props.dirdeploy %>/<%= props.deployname  %>dist/assets/styles/vendors.css': [
                            '<%= props.dirdeploy %>/<%= props.deployname %>/bower_components/angular-autocomplete/angucomplete.css',
                            '<%= props.dirdeploy %>/<%= props.deployname %>/bower_components/angular-calendar/fullcalendar.css',
                            '<%= props.dirdeploy %>/<%= props.deployname %>/bower_components/fonts/font-awesome/css/font-awesome.css',
                            '<%= props.dirdeploy %>/<%= props.deployname %>/bower_components/fonts/glyphicons/css/site.css',
                            '<%= props.dirdeploy %>/<%= props.deployname %>/bower_components/bootstrap/bootstrap.min.css',
                            '<%= props.dirdeploy %>/<%= props.deployname %>/bower_components/angular-ng-table/ng-table.min.css',
                            '<%= props.dirdeploy %>/<%= props.deployname %>/bower_components/angular-ui-select/select.min.css',
                            '<%= props.dirdeploy %>/<%= props.deployname %>/bower_components/styles/style.min.css'

                        ] 
   }
  }

index.html中

 <html>
 <head>
  <!-- build:css assets/styles/styles.css -->
    <link rel="stylesheet" type="text/css" href="bower_components/angular-autocomplete/angucomplete.css"/>
   <link rel="stylesheet" type="text/css" href="bower_components/angular-calendar/fullcalendar.css"/>
    <link rel="stylesheet" type="text/css" href="bower_components/fonts/font-awesome/css/font-awesome.css"/>
   <link rel="stylesheet" type="text/css" href="bower_components/fonts/glyphicons/css/site.css"/>
   <link rel="stylesheet" type="text/css" href="bower_components/bootstrap/bootstrap.min.css"/>
   <link rel="stylesheet" type="text/css" href="bower_components/angular-ng-table/ng-table.min.css"/>
   <link rel="stylesheet" type="text/css" href="bower_components/angular-ui-select/select.min.css" />
   <link rel="stylesheet" type="text/css" href="bower_components/styles/style.min.css"/>
    <!-- endbuild -->

我最终的 index.html 将是

 <html>
  <head>
        <!-- build:css assets/styles/styles.css -->
    <link rel="stylesheet" type="text/css" href="bower_components/angular-autocomplete/angucomplete.css"/>
    <link rel="stylesheet" type="text/css" href="bower_components/angular-calendar/fullcalendar.css"/>
    <link rel="stylesheet" type="text/css" href="bower_components/fonts/font-awesome/css/font-awesome.css"/>
    <link rel="stylesheet" type="text/css" href="bower_components/fonts/glyphicons/css/site.css"/>
    <link rel="stylesheet" type="text/css" href="bower_components/bootstrap/bootstrap.min.css"/>
    <link rel="stylesheet" type="text/css" href="bower_components/angular-ng-table/ng-table.min.css"/>
    <link rel="stylesheet" type="text/css" href="bower_components/angular-ui-select/select.min.css" />
    <link rel="stylesheet" type="text/css" href="bower_components/styles/style.min.css"/>
    <!-- endbuild -->
 </head>
 </html>
4

0 回答 0