0

工作我目前使用的角度引導色器(https://github.com/buberdds/angular-bootstrap-colorpicker角度引導取色不精縮版

,當我在本地運行它,它工作正常。但是,當我使用Grunt構建文件時,ColorPicker停止工作。它不會拋出任何錯誤,但當用戶單擊拾色器時它不會執行任何操作。

我附上Gruntfile.js:

// Project configuration. 
    grunt.initConfig({ 
     connect: { 
      main: { 
       options: { 
        port: 9001 
       } 
      } 
     }, 
     watch: { 
      main: { 
       options: { 
        livereload: true, 
        livereloadOnError: false, 
        spawn: false 
       }, 
       files: [createFolderGlobs(['*.js', '*.less', '*.html']), '!_SpecRunner.html', '!.grunt'], 
       tasks: [] //all the tasks are run dynamically during the watch event handler 
      } 
     }, 
     jshint: { 
      main: { 
       options: { 
        jshintrc: '.jshintrc' 
       }, 
       src: createFolderGlobs('*.js') 
      } 
     }, 
     clean: { 
      before: { 
       src: ['dist', 'temp'] 
      }, 
      after: { 
       src: ['temp'] 
      } 
     }, 
     less: { 
      production: { 
       options: { 
       }, 
       files: { 
        'temp/app.css': 'app.less' 
       } 
      } 
     }, 
     ngtemplates: { 
      main: { 
       options: { 
        module: pkg.name, 
        htmlmin: '<%= htmlmin.main.options %>' 
       }, 
       src: [createFolderGlobs('*.html'), '!index.html', '!_SpecRunner.html'], 
       dest: 'temp/templates.js' 
      } 
     }, 
     copy: { 
      main: { 
       files: [ 
        { src: ['img/**'], dest: 'dist/' }, 
        { src: ['bower_components/font-awesome/fonts/**'], dest: 'dist/', filter: 'isFile', expand: true }, 
        { src: ['bower_components/bootstrap/fonts/**'], dest: 'dist/', filter: 'isFile', expand: true }, 
        { src: ['deploy.json'], dest: 'dist/', filter: 'isFile', expand: true }, 
        { src: ['common/font/**'], dest: 'dist/', filter: 'isFile', expand: true } 

       ] 
      } 
     }, 
     dom_munger: { 
      read: { 
       options: { 
        read: [ 
         { selector: 'script[data-concat!="false"]', attribute: 'src', writeto: 'appjs' }, 
         { selector: 'link[rel="stylesheet"][data-concat!="false"]', attribute: 'href', writeto: 'appcss' } 
        ] 
       }, 
       src: 'index.html' 
      }, 
      update: { 
       options: { 
        remove: ['script[data-remove!="false"]', 'link[data-remove!="false"]'], 
        append: [ 
         { selector: 'body', html: '<script src="app.full.js"></script>' }, 
         { selector: 'head', html: '<link rel="stylesheet" href="app.full.min.css">' } 
        ] 
       }, 
       src: 'index.html', 
       dest: 'dist/index.html' 
      } 
     }, 
     cssmin: { 
      main: { 
       src: ['temp/app.css', '<%= dom_munger.data.appcss %>'], 
       dest: 'dist/app.full.min.css' 
      } 
     }, 
     concat: { 
      main: { 
       src: ['<%= dom_munger.data.appjs %>', '<%= ngtemplates.main.dest %>'], 
       dest: 'temp/app.full.js' 
      } 
     }, 
     ngAnnotate: { 
      main: { 
       src: 'temp/app.full.js', 
       dest: 'dist/app.full.js' 
      } 
     }, 
     uglify: { 
      main: { 
       src: 'temp/app.full.js', 
       dest: 'dist/app.full.min.js' 
      } 
     }, 
     htmlmin: { 
      main: { 
       options: { 
        collapseBooleanAttributes: true, 
        collapseWhitespace: true, 
        removeAttributeQuotes: true, 
        removeComments: true, 
        removeEmptyAttributes: true, 
        removeScriptTypeAttributes: true, 
        removeStyleLinkTypeAttributes: true 
       }, 
       files: { 
        'dist/index.html': 'dist/index.html' 
       } 
      } 
     } 

任何幫助將不勝感激。謝謝!

回答

0

讓我們檢查一下你的Build,看看咕嚕聲對我們有什麼好處。

當你建立把這兩個參數--debug--stack

0

我有同樣的問題。 我想你有在index.html鏈接到CSS和模塊,類似於:

link rel =「stylesheet」href =「../ bower_components/angular-bootstrap-colorpicker/css/colorpicker .min.css 「

SCRIPT SRC =」 ../ bower_components /角自舉-顏色拾取/ JS /自舉-顏色拾取-module.min.js」

事實上,精縮版本不正常工作。這就是爲什麼我從index.html中刪除「.min」,並綁定正常大小的文件:

link rel =「stylesheet」href =「../ bower_components/angular-bootstrap-colorpicker/css/colorpicker.css」

SCRIPT SRC = 「../ bower_components /角引導,顏色拾取/ JS /自舉顏色拾取-module.js」

閒來無事,它爲我工作。