Forráskód Böngészése

improve(dev): css development flow

charlie 4 éve
szülő
commit
67321778a6

+ 15 - 3
gulpfile.js

@@ -20,7 +20,9 @@ const css = {
   buildCSS (...params) {
     return gulp.series(
       () => exec(`yarn css:build`, {}),
-      css._optimizeCSSForRelease)(...params)
+      css._optimizeVendorCSSForRelease,
+      css._optimizeMainCSSForRelease
+    )(...params)
   },
 
   _optimizeCSSForRelease () {
@@ -28,6 +30,16 @@ const css = {
       .pipe(cleanCSS())
       .pipe(gulp.dest(path.join(outputPath, 'css')))
   },
+  _optimizeVendorCSSForRelease () {
+    return gulp.src(path.join(outputPath, 'css', 'vendor.css'))
+      .pipe(cleanCSS())
+      .pipe(gulp.dest(path.join(outputPath, 'css')))
+  },
+  _optimizeMainCSSForRelease () {
+    return gulp.src(path.join(outputPath, 'css', 'main.css'))
+      .pipe(cleanCSS())
+      .pipe(gulp.dest(path.join(outputPath, 'css')))
+  }
 }
 
 const common = {
@@ -40,7 +52,7 @@ const common = {
   },
 
   keepSyncResourceFile () {
-    return gulp.watch(resourceFilePath, { ignoreInitial: false }, common.syncResourceFile)
+    return gulp.watch(resourceFilePath, { ignoreInitial: true }, common.syncResourceFile)
   }
 }
 
@@ -89,5 +101,5 @@ exports.electronMaker = async () => {
 }
 
 exports.clean = common.clean
-exports.watch = gulp.parallel(common.keepSyncResourceFile, css.watchCSS)
+exports.watch = gulp.series(common.syncResourceFile, gulp.parallel(common.keepSyncResourceFile, css.watchCSS))
 exports.build = gulp.series(common.clean, common.syncResourceFile, css.buildCSS)

+ 4 - 4
package.json

@@ -25,8 +25,8 @@
         "tailwindcss": "2.0.3"
     },
     "scripts": {
-        "watch": "run-p gulp:build gulp:watch cljs:watch",
-        "electron-watch": "run-p gulp:build gulp:watch cljs:electron-watch",
+        "watch": "run-p gulp:watch cljs:watch",
+        "electron-watch": "run-p gulp:watch cljs:electron-watch",
         "release": "run-s gulp:build cljs:release",
         "watch-app": "run-p gulp:watch cljs:watch-app",
         "release-app": "run-s gulp:build cljs:release-app",
@@ -41,8 +41,8 @@
         "style:lint": "stylelint \"src/**/*.css\" ",
         "gulp:watch": "gulp watch",
         "gulp:build": "cross-env NODE_ENV=production gulp build",
-        "css:build": "postcss tailwind.all.css -o static/css/tailwind.build.css --verbose",
-        "css:watch": "npm run css:build -- --watch --env development",
+        "css:build": "postcss tailwind.all.css -o static/css/main.css --verbose --env production",
+        "css:watch": "postcss tailwind.all.css -o static/css/main.css --verbose --watch",
         "cljs:watch": "clojure -M:cljs watch app publishing electron",
         "cljs:electron-watch": "clojure -M:cljs watch app electron",
         "cljs:release": "clojure -M:cljs release app publishing electron",

A különbségek nem kerülnek megjelenítésre, a fájl túl nagy
+ 0 - 0
public/index.html


+ 1 - 0
resources/css/main.css

@@ -0,0 +1 @@
+/* Build by gulp. Check `_buildTailwind` for more detail */

+ 13 - 0
resources/css/vendor.css

@@ -0,0 +1,13 @@
+@charset "utf-8";
+@import "./inter.css";
+@import "./reveal.min.css";
+@import "./reveal_black.min.css";
+@import "./fonts.css";
+@import "./excalidraw.min.css";
+@import "./katex.min.css";
+@import "./codemirror.min.css";
+@import "./animation.css";
+@import "./table.css";
+@import "./datepicker.css";
+@import "./highlight.css";
+@import "./tooltip.css";

+ 3 - 1
resources/electron-dev.html

@@ -3,7 +3,8 @@
 <head>
   <meta charset="utf-8">
   <meta content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no" name="viewport">
-  <link href="./css/style.css" rel="stylesheet" type="text/css">
+  <link href="./css/vendor.css" rel="stylesheet" type="text/css">
+  <link href="./css/main.css" rel="stylesheet" type="text/css">
   <link href="./img/logo.png" rel="shortcut icon" type="image/png">
   <link href="./img/logo.png" rel="shortcut icon" sizes="192x192">
   <link href="./img/logo.png" rel="apple-touch-icon">
@@ -26,6 +27,7 @@
   <title>Logseq: A local-first knowledge base</title>
   <meta content="logseq" property="og:site_name">
   <meta content="A local-first knowledge base which can be synced using Git." name="description">
+  <script>window.localStorage.getItem('http-entry-port') && (location.href = 'http://localhost:' + window.localStorage.getItem('http-entry-port'))</script>
 </head>
 <body>
 <div id="root">

+ 2 - 1
resources/electron.html

@@ -3,7 +3,8 @@
 <head>
   <meta charset="utf-8">
   <meta content="minimum-scale=1, initial-scale=1, width=device-width, shrink-to-fit=no" name="viewport">
-  <link href="./css/style.css" rel="stylesheet" type="text/css">
+  <link href="./css/vendor.css" rel="stylesheet" type="text/css">
+  <link href="./css/main.css" rel="stylesheet" type="text/css">
   <link href="./img/logo.png" rel="shortcut icon" type="image/png">
   <link href="./img/logo.png" rel="shortcut icon" sizes="192x192">
   <link href="./img/logo.png" rel="apple-touch-icon">

Nem az összes módosított fájl került megjelenítésre, mert túl sok fájl változott