github.com/imran-kn/cilium-fork@v1.6.9/Documentation/_themes/sphinx_rtd_theme/Gruntfile.js (about)

     1  module.exports = function(grunt) {
     2  
     3    // load all grunt tasks
     4    require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
     5  
     6    grunt.initConfig({
     7      open : {
     8        dev: {
     9          path: 'http://localhost:1919'
    10        }
    11      },
    12  
    13      connect: {
    14        server: {
    15          options: {
    16            port: 1919,
    17            base: 'demo_docs/build',
    18            livereload: true
    19          }
    20        }
    21      },
    22      copy: {
    23        fonts: {
    24          files: [
    25            {
    26                expand: true,
    27                flatten: true,
    28                src: ['bower_components/font-awesome/fonts/*'],
    29                dest: 'sphinx_rtd_theme/static/fonts/',
    30                filter: 'isFile'
    31            },
    32            {
    33                expand: true,
    34                flatten: true,
    35                src: ['bower_components/lato-googlefont/Lato-Regular.ttf',
    36                      'bower_components/lato-googlefont/Lato-Italic.ttf',
    37                      'bower_components/lato-googlefont/Lato-Bold.ttf',
    38                      'bower_components/lato-googlefont/Lato-BoldItalic.ttf'],
    39                dest: 'sphinx_rtd_theme/static/fonts/',
    40                filter: 'isFile'
    41            },
    42            {
    43                expand: true,
    44                flatten: true,
    45                src: ['bower_components/robotoslab-googlefont/RobotoSlab-Bold.ttf',
    46                      'bower_components/robotoslab-googlefont/RobotoSlab-Regular.ttf'],
    47                dest: 'sphinx_rtd_theme/static/fonts/',
    48                filter: 'isFile'
    49            },
    50            {
    51                expand: true,
    52                flatten: true,
    53                src: ['bower_components/inconsolata-googlefont/Inconsolata-Bold.ttf',
    54                      'bower_components/inconsolata-googlefont/Inconsolata-Regular.ttf'],
    55                dest: 'sphinx_rtd_theme/static/fonts/',
    56                filter: 'isFile'
    57            }
    58          ]
    59        }
    60      },
    61  
    62      sass: {
    63        dev: {
    64          options: {
    65            style: 'expanded',
    66            loadPath: ['bower_components/bourbon/dist', 'bower_components/neat/app/assets/stylesheets', 'bower_components/font-awesome/scss', 'bower_components/wyrm/sass']
    67          },
    68          files: [{
    69            expand: true,
    70            cwd: 'sass',
    71            src: ['*.sass'],
    72            dest: 'sphinx_rtd_theme/static/css',
    73            ext: '.css'
    74          }]
    75        },
    76        build: {
    77          options: {
    78            style: 'compressed',
    79            loadPath: ['bower_components/bourbon/dist', 'bower_components/neat/app/assets/stylesheets', 'bower_components/font-awesome/scss', 'bower_components/wyrm/sass']
    80          },
    81          files: [{
    82            expand: true,
    83            cwd: 'sass',
    84            src: ['*.sass'],
    85            dest: 'sphinx_rtd_theme/static/css',
    86            ext: '.css'
    87          }]
    88        }
    89      },
    90  
    91      browserify: {
    92        dev: {
    93          options: {
    94            external: ['jquery'],
    95            alias: {
    96              'sphinx-rtd-theme': './js/theme.js'
    97            }
    98          },
    99          src: ['js/*.js'],
   100          dest: 'sphinx_rtd_theme/static/js/theme.js'
   101        },
   102        build: {
   103          options: {
   104            external: ['jquery'],
   105            alias: {
   106              'sphinx-rtd-theme': './js/theme.js'
   107            }
   108          },
   109          src: ['js/*.js'],
   110          dest: 'sphinx_rtd_theme/static/js/theme.js'
   111        }
   112      },
   113  
   114      exec: {
   115        bower_update: {
   116          cmd: 'bower update'
   117        },
   118        build_sphinx: {
   119          cmd: 'sphinx-build demo_docs/source demo_docs/build'
   120        }
   121      },
   122      clean: {
   123        build: ["demo_docs/build"],
   124        fonts: ["sphinx_rtd_theme/static/fonts"]
   125      },
   126  
   127      watch: {
   128        /* Compile sass changes into theme directory */
   129        sass: {
   130          files: ['sass/*.sass', 'bower_components/**/*.sass'],
   131          tasks: ['sass:dev']
   132        },
   133        /* Changes in theme dir rebuild sphinx */
   134        sphinx: {
   135          files: ['sphinx_rtd_theme/**/*', 'demo_docs/**/*.rst', 'demo_docs/**/*.py'],
   136          tasks: ['clean:build','exec:build_sphinx']
   137        },
   138        /* JavaScript */
   139        browserify: {
   140          files: ['js/*.js'],
   141          tasks: ['browserify:dev']
   142        },
   143        /* live-reload the demo_docs if sphinx re-builds */
   144        livereload: {
   145          files: ['demo_docs/build/**/*'],
   146          options: { livereload: true }
   147        }
   148      }
   149  
   150    });
   151  
   152    grunt.loadNpmTasks('grunt-exec');
   153    grunt.loadNpmTasks('grunt-contrib-connect');
   154    grunt.loadNpmTasks('grunt-contrib-watch');
   155    grunt.loadNpmTasks('grunt-contrib-sass');
   156    grunt.loadNpmTasks('grunt-contrib-clean');
   157    grunt.loadNpmTasks('grunt-contrib-copy');
   158    grunt.loadNpmTasks('grunt-open');
   159    grunt.loadNpmTasks('grunt-browserify');
   160  
   161    grunt.registerTask('fonts', ['clean:fonts','copy:fonts']);
   162    grunt.registerTask('default', ['exec:bower_update','clean:build','sass:dev','browserify:dev','exec:build_sphinx','connect','open','watch']);
   163    grunt.registerTask('build', ['exec:bower_update','clean:build','sass:build','browserify:build','exec:build_sphinx']);
   164  }