M
M
Mike Diam2016-05-04 19:40:21
Grunt.js
Mike Diam, 2016-05-04 19:40:21

How to configure wiredep and usemin?

I want to use bower to automatically add compressed css and js files to the project when installing the package. Can't setup given task in grunt js:
Gruntfile:

wiredep: {
      app: {
        src: 'dest/*.php'
      }
    },
    // end wiredep
    useminPrepare: {
      html: 'dest/*.php',
      options: {
        dest: 'dest',
        flow: {
          html: {
            steps: {
              js: ['concat', 'uglifyjs'],
              css: ['cssmin']
            },
            post: {}
          }
        }
      }
    },
    // end useminPrepare
    usemin: {
      html: ['index.php'],
      css: ['index.php'],
      js: ['index.php']
    },

index.php:
CSS:
    <!-- build:css dest/styles/vendor.css -->
    <!-- bower:css -->
    <!-- endbower -->
    <!-- endbuild -->

    <!-- build:css dest/styles/main.css -->
    <!-- endbuild -->
JS:
      <!-- build:js dest/scripts/vendor.js -->
      <!-- bower:js -->
      <!-- endbower -->
      <!-- endbuild -->

      <!-- build:js dest/scripts/scripts.js -->
      <!-- endbuild -->

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question