2017-01-03 2 views
1

Gibt es eine Gruntjs-Konfiguration für die Verwendung von Kompass-Uhr mit mehreren Projekten auf dem Server? Meine Ordner-Struktur wie folgt aussieht:Wie gruntjs Kompass-Uhr bei mehreren Projekten verwenden

[PROD] 
[project1] 
    [css] 
    styles.css 
    [js] 
    functions.js 
    index.php 
    [scss] 
    styles.scss 

[project2] 
    [css] 
    styles.css 
    [js] 
    functions.js 
    index.php 
    [scss] 
    styles.scss 

[project3] 
    [css] 
    styles.css 
    [js] 
    functions.js 
    index.php 
    [scss] 
    styles.scss 

[TEST] 
    [project1] 
    [css] 
    styles.css 
    [js] 
    functions.js 
    index.php 
    [scss] 
    styles.scss 

    [project2] 
    [css] 
    styles.css 
    [js] 
    functions.js 
    index.php 
    [scss] 
    styles.scss 

    [project3] 
    [css] 
    styles.css 
    [js] 
    functions.js 
    index.php 
    [scss] 
    styles.scss 

N. B. Ja, der Testordner befindet sich im Produktionsordner. Ich muss den automatischen Watcher ausführen, ich arbeite an mehr Projekten in der gleichen Zeit.

Antwort

0

Ich bevorzuge kompilieren scss ohne Kompass. Hier mein finaler Grunt-Skriptcode, der nur modifizierte Dateien kompiliert.

module.exports = function(grunt) { 

grunt.initConfig({ 
    pkg: grunt.file.readJSON('package.json'), 

    watch: { 
    sass: { 
     files: [ 
      'pippo/*/scss/*.scss', 
      'pippo/test/*/scss/*.scss' 
     ], 
     tasks: ['sass'], 
     options: { 
      spawn: false 
     } 
    } 
    }, 

    sass: { 
    dist:{ 
     options: { 
      style: 'compressed' 
     }, 
     files: { 
     'pippo/test/statics/css/ie.css' : 'pippo/test/statics/scss/ie.scss' 
     } 
    } 
    } 

}); 

grunt.event.on('watch', function(action, filepath) { 
    var filepath_scss = filepath; 
    var filepath_css = filepath.replace("scss", "css"); 
    filepath_css = filepath_css.replace("scss", "css"); 
    var finalpath = {}; 
    finalpath[filepath_css] = filepath_scss; 
    grunt.config('sass.dist.files', finalpath); 
}); 

grunt.loadNpmTasks('grunt-contrib-sass'); 
grunt.loadNpmTasks('grunt-contrib-watch'); 
grunt.registerTask('default',['watch']); 
}; 
Verwandte Themen