forked from logseq/logseq
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change output from `resources/static/` to `static/`
- Loading branch information
Showing
11 changed files
with
291 additions
and
283 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,58 @@ | ||
const path = require('path') | ||
const gulp = require('gulp') | ||
const postcss = require('gulp-postcss') | ||
const concat = require('gulp-concat') | ||
const merge = require('merge-stream') | ||
const cleanCSS = require('gulp-clean-css') | ||
const del = require('del') | ||
|
||
const outputPath = path.join(__dirname, 'static') | ||
const resourcesPath = path.join(__dirname, 'resources') | ||
const sourcePath = path.join(__dirname, 'src') | ||
const resourceFilePath = path.join(resourcesPath, '**') | ||
|
||
const tailwind = { | ||
entryPath: './tailwind.css', | ||
cssPath: './src/**/*.css', | ||
outputDir: './resources/static/css/', | ||
outputName: 'tailwind.min.css', | ||
paths: [path.join(__dirname, 'tailwind.css'), path.join(sourcePath, '**/*.css')], | ||
outputDir: path.join(outputPath, 'css'), | ||
outputName: 'tailwind.build.css', | ||
} | ||
|
||
function buildCSS() { | ||
return merge(gulp.src(tailwind.entryPath), gulp.src(tailwind.cssPath)) | ||
.pipe(postcss()) | ||
.pipe(concat(tailwind.outputName)) | ||
.pipe(gulp.dest(tailwind.outputDir)) | ||
} | ||
const css = { | ||
watchCSS() { | ||
return gulp.watch(tailwind.paths, { ignoreInitial: false }, css._buildTailwind) | ||
}, | ||
|
||
function watchCSS() { | ||
return gulp.watch([tailwind.entryPath, tailwind.cssPath], { ignoreInitial: false }, buildCSS) | ||
} | ||
buildCSS(...params) { | ||
return gulp.series(css._buildTailwind, css._optimizeCSSForRelease)(...params) | ||
}, | ||
|
||
_buildTailwind() { | ||
return gulp.src(tailwind.paths) | ||
.pipe(postcss()) | ||
.pipe(concat(tailwind.outputName)) | ||
.pipe(gulp.dest(tailwind.outputDir)) | ||
}, | ||
|
||
function optimizeCSSForRelease() { | ||
return gulp.src('./resources/static/css/style.css') | ||
.pipe(cleanCSS()) | ||
.pipe(gulp.dest('./resources/static/')) | ||
_optimizeCSSForRelease() { | ||
return gulp.src(path.join(outputPath, 'css', 'style.css')) | ||
.pipe(cleanCSS()) | ||
.pipe(gulp.dest(outputPath)) | ||
}, | ||
} | ||
|
||
const releaseCSS = gulp.series(buildCSS, optimizeCSSForRelease) | ||
const common = { | ||
clean() { | ||
return del(outputPath) | ||
}, | ||
|
||
syncResourceFile() { | ||
return gulp.src(resourceFilePath).pipe(gulp.dest(outputPath)) | ||
}, | ||
|
||
keepSyncResourceFile() { | ||
return gulp.watch(resourceFilePath, { ignoreInitial: false }, common.syncResourceFile) | ||
} | ||
} | ||
|
||
exports.watchCSS = watchCSS | ||
exports.buildCSS = buildCSS | ||
exports.releaseCSS = releaseCSS | ||
exports.clean = common.clean | ||
exports.watch = gulp.parallel(common.keepSyncResourceFile, css.watchCSS) | ||
exports.build = gulp.series(common.syncResourceFile, css.buildCSS) |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.