M
M
Mariik2016-08-01 19:50:30
JavaScript
Mariik, 2016-08-01 19:50:30

How to use Bower modules with Browserify loader?

module.exports = function(grunt) {
  grunt.initConfig({
      pkg: grunt.file.readJSON('package.json'),
     
      concat: {
           dist: {
               src: [
                'resources/assets/raw/css/*.css', // Все CSS файлы
                ],
                dest: 'resources/assets/build/css/concat.style.css',
            }
       },
       browserify: {
           dist: {
               options: {
                     transform: ["debowerify"]
               },
               files: {
                   'resources/assets/build/bundle.js': ['resources/assets/raw/js/main.js']
                },
            }
       },
       uglify: {
            options: {
                mangle: false
            },
            my_target: {
                files: {
                    'public/js/bundle.min.js':
                     [
                        'resources/assets/build/bundle.js'
                     ]
                }
            }
      },
      watch: {
          scripts: {
              files: ['resources/assets/raw/js/*.js','resources/assets/raw/css/*.css'],
              tasks: ['concat','browserify','uglify'],
              options: {
                  spawn: false,
                },
            }
        }
});

  // Load the plugin that provides the "uglify" task.
  grunt.loadNpmTasks('grunt-contrib-uglify');
  grunt.loadNpmTasks('grunt-contrib-concat');
  grunt.loadNpmTasks('grunt-contrib-watch');
  grunt.loadNpmTasks('grunt-browserify');

  // Default task(s).
  grunt.registerTask('dev', ['concat','browserify','uglify','watch']);
};

Something Browserify categorically refuses to understand Bower components for me
. The browserify task does not work when requesting any bower component.
Is there really a way to fix this?

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