내 gruntfile을 통해 노드 명령을 실행하려고합니다. 다른 작업을 수행하기 전에 첫 번째 작업으로 다음을 실행하면됩니다.어떻게 Grunt를 통해 노드 스크립트를 실행합니까?
node index.js
나는 주변을 검색해 보았지만 대답을 찾지 못했습니다. 나는 그것이 단순한 무언가일지도 모르다 그러나 나는 확실하지 않다는 것을 믿는다. nmp 작업으로로드해야합니까? 나는 '청소'작업하기 전에 "노드하는 index.js"를 실행하려면
"use strict";
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
jshint: {
all: [
'Gruntfile.js'
],
options: {
jshintrc: '.jshintrc',
},
},
// Before generating any new files, remove any previously-created files.
clean: {
tests: ['dist/*']
},
// Configuration to be run (and then tested).
mustache_render: {
json_data: {
files: [
{
data: 'jsons/offer.json',
template: 'offers.mustache',
dest: 'dist/offers.html'
},
{
data: 'jsons/profile.json',
template: 'profile.mustache',
dest: 'dist/profile.html'
}
]
}
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-mustache-render');
// Whenever the "test" task is run, first clean the "tmp" dir, then run this
// plugin's task(s), then test the result.
grunt.registerTask('default', ['clean', 'jshint', 'mustache_render']);
};
:
이처럼 내 Gruntfile 보이는 방법이다.
흠 ...이 파일을 실행 한 결과는 무엇입니까? –
질문이 업데이트되었습니다. – Blueboye
이 답변을 확인하십시오, 저를 위해 일했습니다! https://stackoverflow.com/a/47304117/5346095 –