如何用grunt以jquery-ui求浏览



我得到了

"Error: Cannot find module './core' from '/var/www/html/psychedharma/public_html/vendor'"

我通常不使用浏览器,但是jquery-ui似乎需要它(请问双关语。)

任何帮助。

module.exports = function(grunt) {
    grunt.loadNpmTasks('grunt-contrib-concat');
    grunt.loadNpmTasks('grunt-contrib-copy');
    grunt.loadNpmTasks('grunt-contrib-uglify');
    grunt.loadNpmTasks('grunt-browserify');
    grunt.initConfig({
        node: './node_modules',
        dest: './public_html/vendor',
        destfaf: './public_html/fonts',
        copy: {
            main: {
                files: [                    
                    {
                        expand: true,
                        flatten: true,
                        src: ['<%= node %>/font-awesome/fonts/fontawesome-webfont.*'],
                        dest: '<%= destfaf %>/', 
                        filter: 'isFile'
                    },
                    {
                        expand: true,
                        flatten: true,
                        src: ['<%= node %>/bootstrap/fonts/glyphicons-halflings-regular.*'],
                        dest: '<%= destfaf %>/', 
                        filter: 'isFile'
                    }
                ]
            }
        },
        concat: {           
            css: {
                files: {
                    '<%= dest %>/css.css': [
                        '<%= node %>/bootstrap/dist/css/bootstrap.min.css',
                        '<%= node %>/font-awesome/css/font-awesome.min.css'
                    ]
                }
            },
            js: {
                files: {
                    '<%= dest %>/js.js': [
                        '<%= node %>/jquery/dist/jquery.min.js',
                        '<%= node %>/bootstrap/dist/js/bootstrap.min.js',
                        '<%= node %>/less/dist/less.min.js',
                        '<%= node %>/jquery-ui/jquery-ui.js',
                        '<%= node %>/jquery-ui/sortable.js'
                    ]
                }
            }
        },
        browserify: {
            dist: {
                files: {
                    '<%= dest %>/js.js': ['<%= dest %>/js.js']
                },
                // options: {
                //     transform: ['coffeeify']
                // }   
            }
        },
        uglify: {
            build: {
                files: {
                    '<%= dest %>/js.min.js': [ '<%= dest %>/js.js' ]
                }
            }
        }
    });
    grunt.registerTask('def', [
        'concat',
        'copy',
        'browserify',
        'uglify'
    ]);
    grunt.registerTask('default', ['def']);
};

好吧,我找到了修复程序。

首先,我使用了官方存储库中的jQuery UI标签:

npm install --save github:jquery/jquery-ui#1.11.4

然后我更换了线:

'<%= node %>/jquery-ui/jquery-ui.js',
'<%= node %>/jquery-ui/sortable.js'

with:

'<%= node %>/jquery-ui/ui/core.js',
'<%= node %>/jquery-ui/ui/widget.js',
'<%= node %>/jquery-ui/ui/mouse.js',
'<%= node %>/jquery-ui/ui/sortable.js'  

毕竟似乎不需要浏览。

最新更新