2016-12-05 2 views
1

Das Problem ist, ich bin nicht in der Lage, die CSS-Dateien in einem Dist-Ordner zu minimieren. Ich bekomme den folgenden Fehler, wenn ich den Befehl 'grunt' ausführen. Hilf mir. Danke im Voraus.Grunt: CSS-Datei nicht minimiert

Running "concat:dist" (concat) task 

Running "cssmin:dist" (cssmin) task 
>> No files created. 

Running "uglify:dist" (uglify) task 
>> No files created. 

Running "copy:dist" (copy) task 


Running "copy:fonts" (copy) task 

Meine HTML-Datei Kopf und der Code für Grunt.js ist wie folgt:

'use strict'; 
 

 
module.exports = function (grunt) { 
 
    // Define the configuration for all the tasks 
 
    \t // Time how long tasks take. Can help when optimizing build times 
 
    \t require('time-grunt')(grunt); 
 

 
    \t // Automatically load required Grunt tasks 
 
    \t require('jit-grunt')(grunt, { 
 
    \t useminPrepare: 'grunt-usemin' 
 
    \t }); 
 
    \t // Define the configuration for all the tasks 
 
    \t grunt.initConfig({ 
 
    \t pkg: grunt.file.readJSON('package.json'), 
 

 
    \t // Make sure code styles are up to par and there are no obvious mistakes 
 
    \t jshint: { 
 
    \t  options: { 
 
    \t  jshintrc: '.jshintrc', 
 
    \t  reporter: require('jshint-stylish') 
 
    \t  }, 
 
    \t  
 
    \t  all: { 
 
    \t  src: [ 
 
    \t   'Gruntfile.js', 
 
    \t   'app/scripts/{,*/}*.js' 
 
    \t  ] 
 
    \t  } 
 
    \t }, 
 
    \t copy: { 
 
    \t  dist: { 
 
    \t  cwd: 'app', 
 
    \t  src: [ '**','!styles/**/*.css','!scripts/**/*.js' ], 
 
    \t  dest: 'dist', 
 
    \t  expand: true 
 
    \t  }, 
 
    \t  
 
    \t  fonts: { 
 
    \t  files: [ 
 
    \t   { 
 
    \t   //for bootstrap fonts 
 
    \t   expand: true, 
 
    \t   dot: true, 
 
    \t   cwd: 'bower_components/bootstrap/dist', 
 
    \t   src: ['fonts/*.*'], 
 
    \t   dest: 'dist' 
 
    \t   }, { 
 
    \t   //for font-awesome 
 
    \t   expand: true, 
 
    \t   dot: true, 
 
    \t   cwd: 'bower_components/font-awesome', 
 
    \t   src: ['fonts/*.*'], 
 
    \t   dest: 'dist' 
 
    \t   } 
 
    \t  ] 
 
    \t  } 
 
    \t }, 
 

 
    \t clean: { 
 
    \t  build: { 
 
    \t  src: [ 'dist/'] 
 
    \t  } 
 
    \t }, 
 

 

 
    \t useminPrepare: { 
 
    \t html: 'app/detail.html', 
 
    \t options: { 
 
    \t  dest: 'dist' 
 
    \t } 
 
    \t }, 
 

 
    \t // Concat 
 
    \t concat: { 
 
    \t options: { 
 
    \t  separator: ';' 
 
    \t }, 
 
    \t 
 
    \t // dist configuration is provided by useminPrepare 
 
    \t dist: {} 
 
    \t }, 
 

 
    \t // Uglify 
 
    \t uglify: { 
 
    \t // dist configuration is provided by useminPrepare 
 
    \t dist: {} 
 
    \t }, 
 

 
    \t cssmin: { 
 
    \t dist: {} 
 
    \t }, 
 

 
    \t // Filerev 
 
    \t filerev: { 
 
    \t options: { 
 
    \t  encoding: 'utf8', 
 
    \t  algorithm: 'md5', 
 
    \t  length: 20 
 
    \t }, 
 
    \t 
 
    \t release: { 
 
    \t  // filerev:release hashes(md5) all assets (images, js and css) 
 
    \t  // in dist directory 
 
    \t  files: [{ 
 
    \t  src: [ 
 
    \t   'dist/scripts/*.js', 
 
    \t   'dist/styles/*.css', 
 
    \t  ] 
 
    \t  }] 
 
    \t } 
 
    \t }, 
 
    \t 
 
    \t // Usemin 
 
    \t // Replaces all assets with their revved version in html and css files. 
 
    \t // options.assetDirs contains the directories for finding the assets 
 
    \t // according to their relative paths 
 
    \t usemin: { 
 
    \t html: ['dist/*.html'], 
 
    \t css: ['dist/styles/*.css'], 
 
    \t options: { 
 
    \t  assetsDirs: ['dist', 'dist/styles'] 
 
    \t } 
 
    \t } 
 
    \t }); 
 

 
    \t grunt.registerTask('build', [ 
 
    \t 'clean', 
 
    \t 'jshint', 
 
    \t 'useminPrepare', 
 
    \t 'concat', 
 
    \t 'cssmin', 
 
    \t 'uglify', 
 
    \t 'copy', 
 
    \t 'filerev', 
 
    \t 'usemin' 
 
    \t ]); 
 
    \t grunt.registerTask('default',['build']); 
 

 
}; \t
<head> 
 
    <title>Angular JS</title> 
 

 
    <!-- build:css styles/main.css --> 
 
    <link href="../bower_components/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet"> 
 
    <link href="../bower_components/bootstrap/dist/css/bootstrap-theme.min.css" rel="stylesheet"> 
 
    <link href="../bower_components/font-awesome/css/font-awesome.min.css" rel="stylesheet"> 
 
    <link href="styles/bootstrap-social.css" rel="stylesheet"> 
 
    <link href="styles/mystyles.css" rel="stylesheet"> 
 
    <!-- endbuild --> 
 
</head>

Antwort

0

Ihre cssmin: leer!

Sie benötigen, wie etwas zu tun:

cssmin: { 
    target: { 
    files: [{ 
     expand: true, 
     cwd: 'release/css', 
     src: ['dist/styles/*.css', '!*.min.css'], 
     dest: 'release/css', 
     ext: '.min.css' 
    }] 
    } 
} 

Werfen Sie einen Blick auf: https://github.com/gruntjs/grunt-contrib-cssmin