我正试图用咕噜咕噜地表达我的角度应用程序。目前,服务任务如下所示:
module.exports = function(grunt) {
grunt.registerTask('serve', function(target) {
// Default task
grunt.task.run([
'clean',
// init
//'concurrent:init',
// compile html, styles, and scripts
//'concurrent:compile',
// 'uglify',
// 'Karma',
'express:server',
'open:browser',
'watch'
]);
});
};
我只想在没有任何复制,缩小等的情况下为角度应用程序提供服务。我该怎么做?
答案 0 :(得分:0)
我建议您使用Browserify,这是通过Grunt提供JS应用程序的最简单方法之一。下面是一个示例,假设您的JS应用程序位于src
目录中,其根目录为index.html
:
<强> grunfile.js 强>
module.exports = function(grunt) {
grunt.initConfig({
browserSync: {
bsFiles: {
src: './src/**/*'
},
options: {
server: './src'
}
}
});
grunt.loadNpmTasks('grunt-browser-sync');
grunt.registerTask('default', ['browserSync']);
};
您显然需要在(npm i -D grunt-browser-sync
)之前安装 grunt-browser-sync 。
如果您仍然希望使用快递,因为您将在制作中使用快递,我建议使用grunt-express plugin,有一个使用Angular, Express and Grunt here的完整示例应用。它已有3年历史,但仍在使用实际的Angular + Express应用程序。