From c3fbdd9d5d43af2aac6a91684a46f60ae3f1428a Mon Sep 17 00:00:00 2001 From: cagataycivici Date: Sat, 25 May 2019 16:49:00 +0300 Subject: [PATCH] build css script --- .gitignore | 3 +++ build-lib.js | 7 +------ gulpfile.js | 44 ++++++++++++++++++++++++++++++++++++++++++++ package.json | 13 +++++++++---- 4 files changed, 57 insertions(+), 10 deletions(-) create mode 100644 gulpfile.js diff --git a/.gitignore b/.gitignore index e3408dc73..f292afd97 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ .DS_Store node_modules /dist +/resources +/components # misc /.sass-cache @@ -28,3 +30,4 @@ yarn-error.log* *.njsproj *.sln *.sw* + diff --git a/build-lib.js b/build-lib.js index 6ec6a1a07..5919bf440 100644 --- a/build-lib.js +++ b/build-lib.js @@ -1,13 +1,8 @@ const fs = require('fs-extra'); const path = require('path'); -const { execSync } = require('child_process'); +const {execSync} = require('child_process'); const vueCliServicePath = path.resolve(__dirname, 'node_modules/@vue/cli-service/bin/vue-cli-service'); -fs.copyFile('source.txt', 'destination.txt', (err) => { - if (err) throw err; - console.log('source.txt was copied to destination.txt'); - }); - fs.readdirSync(path.resolve(__dirname, './src/components/')).forEach(folder => { fs.readdirSync(path.resolve(__dirname, './src/components/' + folder)).forEach(file => { if (/\.vue$/.test(file)) { diff --git a/gulpfile.js b/gulpfile.js new file mode 100644 index 000000000..cec7f5a7f --- /dev/null +++ b/gulpfile.js @@ -0,0 +1,44 @@ +'use strict'; + +var gulp = require('gulp'), + concat = require('gulp-concat'), + uglifycss = require('gulp-uglifycss'), + rename = require('gulp-rename'), + del = require('del'), + flatten = require('gulp-flatten'); + +gulp.task('build-css', function() { + return gulp.src([ + 'src/components/common/Common.css', + 'src/components/**/*.css' + ]) + .pipe(concat('primevue.css')) + .pipe(gulp.dest('resources')) + .pipe(uglifycss({"uglyComments": true})) + .pipe(rename('primevue.min.css')) + .pipe(gulp.dest('resources')); +}); + +gulp.task('build-themes', function() { + return gulp.src([ + 'public/themes/**/*' + ]) + .pipe(uglifycss({"uglyComments": true})) + .pipe(gulp.dest('resources/themes')); +}) + +gulp.task('images', function() { + return gulp.src(['src/components/**/images/*.png', 'src/components/**/images/*.gif']) + .pipe(flatten()) + .pipe(gulp.dest('resources/images')); +}); + +gulp.task('build-exports', function() { + return gulp.src(['exports/*.js','exports/*.d.ts']) + .pipe(gulp.dest('./')); +}); + +//Building project with run sequence +gulp.task('build-resources', ['build-css','images', 'build-themes']); + + \ No newline at end of file diff --git a/package.json b/package.json index e2cae22c0..06aa5e375 100644 --- a/package.json +++ b/package.json @@ -8,8 +8,9 @@ "license": "MIT", "scripts": { "serve": "vue-cli-service serve", - "build": "vue-cli-service build", + "build-app": "vue-cli-service build", "build-lib": "node build-lib", + "build-resources": "gulp build-resources", "lint": "vue-cli-service lint", "test:unit": "vue-cli-service test:unit" }, @@ -37,9 +38,13 @@ "@fullcalendar/daygrid": "4.0.1", "@fullcalendar/interaction": "4.0.2", "@fullcalendar/timegrid": "4.0.1", - "chart.js": "2.7.3" - }, - "dependencies": { + "chart.js": "2.7.3", + "gulp": "^3.9.1", + "gulp-concat": "^2.6.0", + "gulp-flatten": "^0.2.0", + "gulp-rename": "^1.2.2", + "gulp-uglify": "^1.5.3", + "gulp-uglifycss": "^1.0.6", "prism-es6": "^1.1.2", "prismjs": "^1.15.0" }