将gulp dist文件夹链接到apache2

时间:2015-07-25 14:24:57

标签: apache build apache2 gulp

我需要部署我的' dist'从gulp构建到我的public_html文件夹的文件夹。 (与 / var / www 相同)

gulpfile.js

// gulp
var gulp = require('gulp');

// plugins
var connect = require('gulp-connect');
var jshint = require('gulp-jshint');
var uglify = require('gulp-uglify');
var minifyCSS = require('gulp-minify-css');
var clean = require('gulp-clean');
var concat = require('gulp-concat');

// tasks
gulp.task('lint', function() {
  gulp.src('./js/*.js')
    .pipe(jshint())
    .pipe(jshint.reporter('default'))
    .pipe(jshint.reporter('fail'));
});
gulp.task('clean', function() {
    gulp.src('./dist/*')
      .pipe(clean({force: true}));
});
gulp.task('minify-css', function() {
  var opts = {comments:true,spare:true};
  gulp.src('./css/*.css')
    .pipe(minifyCSS(opts))
    .pipe(gulp.dest('./dist/'))
});
gulp.task('minify-js', function() {
  gulp.src('./js/*.js')
    .pipe(uglify())
    .pipe(concat('build.js'))
    .pipe(gulp.dest('./dist/'))
});
gulp.task('copy-bower-components', function () {
  gulp.src('./bower_components/**')
    .pipe(gulp.dest('dist/bower_components'));
});
gulp.task('copy-html-files', function () {
  gulp.src('./*.html')
    .pipe(gulp.dest('dist/'));
});
gulp.task('connect', function () {
  connect.server({
    //root: 'app/',
    //port: 8888
  });
});
gulp.task('connectDist', function () {
  connect.server({
    root: 'dist/',
    port: 80,
  });
});


// default task
gulp.task('default',
  ['lint', 'connect']
);
// build task
gulp.task('build',
  ['lint', 'minify-css', 'minify-js', 'copy-html-files', 'copy-bower-components', 'connectDist']
);

我停止运行apache2实例并运行$ gulp clean build,它将生成以下错误

zeeba@inspiron:~/Desktop/app02$ gulp clean
[19:47:30] Using gulpfile ~/Desktop/app02/gulpfile.js
[19:47:30] Starting 'clean'...
[19:47:30] Finished 'clean' after 6.41 ms
zeeba@inspiron:~/Desktop/app02$ gulp build
[19:47:33] Using gulpfile ~/Desktop/app02/gulpfile.js
[19:47:33] Starting 'lint'...
[19:47:33] Finished 'lint' after 9.01 ms
[19:47:33] Starting 'minify-css'...
[19:47:33] Finished 'minify-css' after 3.55 ms
[19:47:33] Starting 'minify-js'...
[19:47:33] Finished 'minify-js' after 3.54 ms
[19:47:33] Starting 'copy-html-files'...
[19:47:33] Finished 'copy-html-files' after 1.74 ms
[19:47:33] Starting 'copy-bower-components'...
[19:47:33] Finished 'copy-bower-components' after 783 μs
[19:47:33] Starting 'connectDist'...
[19:47:33] Finished 'connectDist' after 10 ms
[19:47:33] Starting 'build'...
[19:47:33] Finished 'build' after 7.42 μs

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: listen EACCES
    at errnoException (net.js:901:11)
    at Server._listen2 (net.js:1020:19)
    at listen (net.js:1061:10)
    at Server.listen (net.js:1135:5)
    at ConnectApp.server (/home/zeeba/Desktop/app02/node_modules/gulp-connect/index.js:57:19)
    at new ConnectApp (/home/zeeba/Desktop/app02/node_modules/gulp-connect/index.js:37:10)
    at Object.module.exports.server (/home/zeeba/Desktop/app02/node_modules/gulp-connect/index.js:170:12)
    at Gulp.<anonymous> (/home/zeeba/Desktop/app02/gulpfile.js:50:11)
    at module.exports (/home/zeeba/Desktop/app02/node_modules/gulp/node_modules/orchestrator/lib/runTask.js:34:7)
    at Gulp.Orchestrator._runTask (/home/zeeba/Desktop/app02/node_modules/gulp/node_modules/orchestrator/index.js:273:3)
zeeba@inspiron:~/Desktop/app02$

如何部署到我的apache服务器?这个配置不正确吗?

我需要帮助你们。谢谢。

0 个答案:

没有答案