[英]Run grunt-preprocess before grunt serve
我需要在執行grunt serve task
之前運行grunt-preprocess ,以便使用開發設置更新index.html
。
是否可以不修改index.html
位置?
在dist進程中,在將index.html
復制到dest文件夾后,我運行grunt-preprocess任務。
您可以定義運行grunt serve
時需要執行的任務列表,其方式類似於yeoman的方式。 您的最終結果可能是這樣的:
grunt.registerTask('serve', 'start the server and preview your app', [
'clean:dist',
'copy',
'preprocess',
'connect:livereload',
'open',
'watch'
]);
您基本上是使用grunt.registerTask
注冊alias
任務的。
如果指定了任務列表,則新任務將是一個或多個其他任務的別名。 每當運行此“別名任務”時,都會按照指定的順序運行taskList中的每個指定任務。
換句話說,如果您已經使用了諸如grunt-serve之類的任務,那么您將已經有一個名為serve
的任務,您將對其進行別名,如以下示例所示:
grunt.registerTask('serve', 'start the server and preview your app', [
'clean:dist',
'copy',
'preprocess',
'serve:dist'
]);
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.