내 Gruntfile은 "files"
을 반복하여 동일한 작업의 두 대상 (dist
및 dev
)간에 공유합니다.그랑트 대상간에 파일을 공유하는 방법은 무엇입니까?
"use strict";
module.exports = function (grunt) {
grunt.loadNpmTasks("grunt-contrib-stylus");
grunt.initConfig({
stylus: {
dist: {
files: { "www/bundle.css": ["stylus/*.styl"] },
options: { compress: true, linenos: false }
},
dev: {
files: { "www/bundle.css": ["stylus/*.styl"] },
options: { compress: false, linenos: true }
}
}
});
grunt.registerTask("dev", ["stylus:dev"]);
grunt.registerTask("prod", ["stylus:prod"]);
};
그래서 모두 목표에 그것을 반복하지 않아도 수준을 config (설정) 파일을 이동하는 방법은 무엇입니까 : 여기에 전용 스타일러스 문제를 포함하는 샘플입니다?
"var myFiles = {"www/bundle.css ": ["stylus/*. styl "]};" grunt.initConfig 전에 "files : myFiles"라고 말하면됩니다. 그냥 대상 일 뿐이야, 안 그래? 모든 객체에 파일 속성을 삽입하는 함수를 작성할 수는있을 것이라고 확신하지만 DRY를 의미하지만 어느 시점에서는 약간의 편의를 위해 많은 복잡성을 다루고 있습니다. – dtudury
다음 질문과 중복됩니다 : http://stackoverflow.com/questions/15927368 – thorn
트래커 문제 : https://github.com/gruntjs/grunt/issues/1029 – thorn