2015-09-29 4 views
0

Быстрый вопрос, пытаясь получить postcss работать и продолжать получатьПроблемы с Postcss конфигурации в gruntfile

"SyntaxError: /Users/todd.kidder/Documents/sitecore-site/Gruntfile.js:40 
>>   });" 

ошибку, когда я иду, чтобы запустить задачу по умолчанию.

Я уверен, что ошибка очевидна, но совершенно новая в этом, я css grunt по торговле.

Оцените любую помощь, которую я могу получить.

module.exports = function(grunt) { 

    // 1. All configuration goes here 
    grunt.initConfig({ 
      pkg: grunt.file.readJSON('package.json'), 
      uncss: { 
       dist: { 
        files: { 
         'cleaned-css/tidy.css': ['index.html'] 
        } 
       } 
      }, 
      cssnano: { 
       options: { 
        sourcemap: true 
       }, 
       dist: { 
        files: { 
         'cleaned-css/tidy.css': 'cleaned-css/tidy.css' 
        } 
       } 
      }, 
      postcss: { 
       options: { 
        map: true, 
        processors: [ 
         require('autoprefixer-core')({ 
          browsers: 'last 2 version' 
         }).postcss, 
        ] 
       }, 
       dist: { 
        expand: true, 
        flatten: true, 
        src: 'cleaned-css/tidy.css' 
       } 
      } 
     } 

    }); 


// 3. Where we tell Grunt we plan to use this plug-in. 
grunt.loadNpmTasks('grunt-uncss'); 
grunt.loadNpmTasks('grunt-cssnano'); 
grunt.loadNpmTasks('grunt-postcss'); 
grunt.loadNpmTasks('autoprefixer'); 


// 4. Where we tell Grunt what to do when we type "grunt" into the terminal. 
grunt.registerTask('default', ['uncss', 'postcss']); 
grunt.registerTask('build', ['uncss', 'postcss', 'cssnano']); 

}; 

ответ

0

Я думаю, проблема проста в типовой проблеме.

Пожалуйста, попробуйте это:

 

    
    module.exports = function(grunt) { 

     // 1. All configuration goes here 
     grunt.initConfig({ 
      pkg: grunt.file.readJSON('package.json'), 
      uncss: { 
       dist: { 
        files: { 
         'cleaned-css/tidy.css': ['index.html'] 
        } 
       } 
      }, 
      cssnano: { 
       options: { 
        sourcemap: true 
       }, 
       dist: { 
        files: { 
         'cleaned-css/tidy.css': 'cleaned-css/tidy.css' 
        } 
       } 
      }, 
      postcss: { 
       options: { 
        map: true, 
        processors: [ 
         require('autoprefixer-core')({ 
          browsers: 'last 2 version' 
         }).postcss, 
        ] 
       }, 
       dist: { 
        expand: true, 
        flatten: true, 
        src: 'cleaned-css/tidy.css' 
       } 
      } 
     }) 
    }; 


    // 3. Where we tell Grunt we plan to use this plug-in. 
    grunt.loadNpmTasks('grunt-uncss'); 
    grunt.loadNpmTasks('grunt-cssnano'); 
    grunt.loadNpmTasks('grunt-postcss'); 
    grunt.loadNpmTasks('autoprefixer'); 


    // 4. Where we tell Grunt what to do when we type "grunt" into the terminal. 
    grunt.registerTask('default', ['uncss', 'postcss']); 
    grunt.registerTask('build', ['uncss', 'postcss', 'cssnano']); 
 

Надежда, что помогает.

С уважением, micha

Смежные вопросы