我在哪里注册我的JS,以便它被添加grunt?

我用了一个yeoman生成器(html5网站)。

我有一个现有的项目,我想翻译成咕噜/鲍尔工作stream程。

我有一个.js文件,做我想要的,从旧的项目。 将其复制到新的基于bower / grunt的项目的开发文件夹中不会导致它被连接到最终的单个mainsite.js。

所以我检查了gruntfile.js并在这里添加它:

concat : { options: { banner: '<%= banner %>', stripBanners: false }, main : { src : [ 'bower_components/jquery/dist/jquery.js', 'bower_components/jQueryui/ui/jquery-ui.js', 'bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.js ', 'bower_components/RWD-FitText.js/jquery.fittext.js', 'bower_components/BrowserDetection.js/BrowserDetection.js', 'bower_components/respond/dest/respond.src.js', 'main-2k15-dribble/JavaScript/Main.js', 'main-2k15-dribble/JavaScript/mainsite.js', this added---> 'main-2k15-dribble/JavaScript/jribble.js' ], dest : 'main-2k15-dribble-pub/js/mainsite.js' } }, 

我特别想知道我需要做些什么来将我现有的JavaScript添加到由grunt和bowerpipe理的项目中?

一般来说,我从来没有见过明确的描述什么文件夹是什么意思,以及工作stream程添加到脚手架的项目。 但我觉得必须有一些维基或什么教这个! 我不相信开发者会通过线索和错误发现

我不能猜测你是否这样做了,但你需要加载grunt-contrib-concat npm,然后注册一个任务来完成,所以你的Gruntfile.js看起来应该像下面这样:

 'use strict'; module.exports = function (grunt) { // Project Configuration grunt.initConfig({ concat: { options: { banner: '<%= banner %>', stripBanners: false }, main: { src: [ 'bower_components/jquery/dist/jquery.js', 'bower_components/jQueryui/ui/jquery-ui.js', 'bower_components/jqueryui-touch-punch/jquery.ui.touch-punch.js ', 'bower_components/RWD-FitText.js/jquery.fittext.js', 'bower_components/BrowserDetection.js/BrowserDetection.js', 'bower_components/respond/dest/respond.src.js', 'main-2k15-dribble/JavaScript/Main.js', 'main-2k15-dribble/JavaScript/mainsite.js', 'main-2k15-dribble/JavaScript/jribble.js'], dest: 'main-2k15-dribble-pub/js/mainsite.js' } }, }); require('load-grunt-tasks')(grunt); grunt.loadNpmTasks('grunt-contrib-concat'); grunt.registerTask('concat', ['concat']); }; 

然后运行它为:

 grunt concat