Last active
January 14, 2020 21:01
-
-
Save yaredc/c2ad5b2d9e8c0e2d6da16bf58432ddb1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict' | |
const gulp = require('gulp') | |
const babel = require('gulp-babel') | |
const sass = require('gulp-sass') | |
const uglifyCss = require('gulp-uglifycss') | |
const uglifyJs = require('gulp-uglify') | |
const concat = require('gulp-concat') | |
const ts = require('gulp-typescript') | |
const del = require('del') | |
const replace = require('gulp-replace') | |
const libsTs = [ | |
'node_modules/jquery/src/jquery.js', | |
'node_modules/jquery-ui/ui/widget.js', | |
'node_modules/jquery.autocomplete/jquery.autocomplete.js', | |
'node_modules/lightgallery/src/js/lightgallery.js', | |
'node_modules/typed.js/lib/typed.js', | |
'public/.ts/app.ts', | |
] | |
const libsScss = [ | |
'node_modules/bootstrap/scss/bootstrap.scss', | |
'node_modules/jquery-ui/themes/base/all.css', | |
'node_modules/font-awesome/scss/font-awesome.scss', | |
'public/.scss/jquery.mThumbnailScroller.css', | |
'public/.scss/app.scss', | |
] | |
const libAssets = [ | |
'node_modules/font-awesome/fonts/*', | |
] | |
function clean () { | |
return del(['public/static/*']) | |
} | |
function css () { | |
return gulp.src(libsScss). | |
pipe(sass()). | |
pipe(uglifyCss()). | |
pipe(concat('app.css')). | |
pipe(replace(/(?<=(src|url)\w*\(\w*("|')).+?(?=("|')\w*\)\w*)/g, (match) => { | |
if (!match.startsWith('data')) { | |
const parts = match.split('/') | |
return '/static/' + parts.pop() | |
} | |
})). | |
pipe(gulp.dest('./public/static/')) | |
} | |
function assets () { | |
return gulp.src(libAssets). | |
pipe(gulp.dest('./public/static/')) | |
} | |
function js () { | |
return gulp.src(libsTs). | |
pipe(ts({ noImplicitAny: false, allowJs: true })). | |
pipe(babel()). | |
pipe(uglifyJs()). | |
pipe(concat('app.js')). | |
pipe(gulp.dest('./public/static/')) | |
} | |
function watch () { | |
gulp.watch(libsScss, js) | |
gulp.watch(libsTs, css) | |
} | |
const build = gulp.series(clean, gulp.parallel(assets, css, js)) | |
exports.clean = clean | |
exports.css = css | |
exports.js = js | |
exports.watch = watch | |
exports.build = build | |
exports.default = build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "app", | |
"description": "app", | |
"version": "1.0.0", | |
"license": "unlicenced", | |
"private": true, | |
"dependencies": { | |
"@babel/core": "^7.7.5", | |
"@types/jquery": "^3.3.31", | |
"@types/jqueryui": "^1.12.9", | |
"@types/node": "^12.12.20", | |
"bootstrap": "^4.4.1", | |
"bootswatch": "^4.4.1", | |
"core-js": "^3.5.0", | |
"cross-env": "^6.0.3", | |
"del": "^5.1.0", | |
"font-awesome": "^4.7.0", | |
"gsap": "^3.0.4", | |
"gulp": "^4.0.2", | |
"gulp-babel": "^8.0.0", | |
"gulp-cli": "^2.2.0", | |
"gulp-concat": "^2.6.1", | |
"gulp-copy": "^4.0.1", | |
"gulp-css": "^0.1.0", | |
"gulp-less": "^4.0.1", | |
"gulp-replace": "^1.0.0", | |
"gulp-sass": "^4.0.2", | |
"gulp-typescript": "^5.0.1", | |
"gulp-uglify": "^3.0.2", | |
"gulp-uglifycss": "^1.1.0", | |
"jquery": "^3.4.1", | |
"jquery-ui": "^1.12.1", | |
"jquery.autocomplete": "^1.2.0", | |
"lightgallery": "^1.6.12", | |
"node-sass": "^4.13.0", | |
"popper.js": "^1.16.0", | |
"swiper": "^5.2.1", | |
"typed.js": "^2.0.10", | |
"typescript": "^3.7.3" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment