我有一个简单的Gulp构建过程设置用于测试.我已多次阅读文档,但我似乎无法通过Gulp-inject将我想要的脚本注入index.html文件中.
我的Gulp文件如下所示:
gulp.task('inject1', function() {
return gulp.src('app/index.html')
.pipe(inject(gulp.src('./app/scripts/app.js', {read : false}))) // Not necessary to read the files (will speed up things), we're only after their paths
.pipe(gulp.dest("dist"));
});
gulp.task('inject2', function() {
return gulp.src('app/scripts/**/*.js', {read : false}) // Not necessary to read the files (will speed up things), we're only after their paths
.pipe(inject("./app/index.html"))
.pipe(gulp.dest("./dist"));
});
Run Code Online (Sandbox Code Playgroud)
这是我的Index.html的一部分:
<!-- inject:js -->
<!-- endinject-->
Run Code Online (Sandbox Code Playgroud)
这两个都是从github上的文档中复制的.
当我运行这些任务中的任何一个时,控制台只是说"已启动"注入'完成'注入''
在我的./dist文件夹中,它创建了一个Index.html文件但没有注入js文件.
我已经尝试在src中键入并以许多不同的方式注入属性但没有运气.知道我做错了什么吗?
我正在尝试让Jenkins在Cloudbees上构建并运行.我已经成功安装了NodeJs并从我的BitBucket存储库中取出了我的源代码.我试图在部署之前运行我的grunt任务来缩小和连接我的JS和CSS文件.但是,即使已成功安装,我也无法运行grunt程序.以下是我的构建脚本:
curl -s -o use-node https://repository-cloudbees.forge.cloudbees.com/distributions/ci-addons/node/use-node
NODE_VERSION=0.8.0 \
source ./use-node
npm install
npm install grunt
grunt
Run Code Online (Sandbox Code Playgroud)
我尝试使用和不使用-g选项安装grunt但没有成功.这是我构建的grunt部分的控制台输出:
+ npm install grunt
...
npm http GET https://registry.npmjs.org/grunt
npm http 200 https://registry.npmjs.org/grunt
...
grunt@0.4.0 node_modules/grunt
??? dateformat@1.0.2-1.2.3
??? colors@0.6.0-1
??? hooker@0.2.3
??? eventemitter2@0.4.11
??? which@1.0.5
??? iconv-lite@0.2.7
??? coffee-script@1.3.3
??? lodash@0.9.2
??? nopt@1.0.10 (abbrev@1.0.4)
??? rimraf@2.0.3 (graceful-fs@1.1.14)
??? minimatch@0.2.11 (sigmund@1.0.0, lru-cache@2.2.2)
??? glob@3.1.21 (graceful-fs@1.2.0, inherits@1.0.0)
??? findup-sync@0.1.2 (lodash@1.0.1)
??? js-yaml@1.0.3 (argparse@0.1.12)
+ grunt
/tmp/hudson3382014549646667419.sh: line 8: grunt: command not found
Build step …Run Code Online (Sandbox Code Playgroud)