重新安装节点js gulp后工作不正常,但之前它工作得很好。我尝试了很多方法,并在github和论坛上阅读了很多问题,但没有...尝试删除全局安装的软件包和本地安装。重新安装节点js,更新节点js,安装[email protected] ......等
在这里我的gulpfile:
gulp.task('js', function() {
return gulp.src([
'app/js/lightgallery.min.js',
'app/js/jquery.dotdotdot.min.js',
'app/js/common.js',
'app/js/jquery.magnific-popup.min.js'
])
.pipe(concat('scripts.min.js'))
.pipe(uglify())
.pipe(gulp.dest('app/js-output'))
.pipe(browserSync.reload({ stream: true }))
});
gulp.task('css', function() {
return gulp.src([
'app/css/header.css',
'app/css/bootstrap.css'
])
.pipe(concat('style.min.css'))
.pipe(autoprefixer(['last 15 versions']))
.pipe(cleancss( {level: { 1: { specialComments: 0 } } })) // Opt., comment out when debugging
.pipe(gulp.dest('app/css-output'))
.pipe(browserSync.stream())
});
这里是package.json:
{
"name": "somename",
"version": "4.0.0",
"description": "somedescr",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "someone",
"license": "ISC",
"devDependencies": {
"browser-sync": "^2.26.3",
"gulp": "^3.9.1",
"gulp-autoprefixer": "^6.0.0",
"gulp-clean-css": "^3.10.0",
"gulp-concat": "^2.6.1",
"gulp-notify": "^3.2.0",
"gulp-rename": "^1.4.0",
"gulp-rsync": "0.0.8",
"gulp-sass": "^4.0.1",
"gulp-uglify": "^3.0.1",
"gulp-util": "^3.0.8"
}
}
我必须做些什么才能让它发挥作用?或者也许是任何替代方式只需点击一下即可在本地计算机上连接和缩小js,css,sass?
我找到了使用PHP脚本压缩js和css的替代方法,并在本地服务器上运行它。找到用PHP编写的非常有用的库:
并编写了简单的主脚本来使用它们并进行输出。也许对于某人这些信息可能有帮助...