Skip to content

Commit

Permalink
refactor(draw): handle static assets from node_modules
Browse files Browse the repository at this point in the history
  • Loading branch information
andelf committed Feb 18, 2022
1 parent 1bb06de commit 54215ef
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
12 changes: 10 additions & 2 deletions gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,14 @@ const common = {
return gulp.src(resourceFilePath).pipe(gulp.dest(outputPath))
},

syncAssetFiles () {
return gulp.src([
"./node_modules/@excalidraw/excalidraw/dist/excalidraw-assets/**",
"!**/*/i18n-*.js"
])
.pipe(gulp.dest(path.join(outputPath, 'js', 'excalidraw-assets')))
},

keepSyncResourceFile () {
return gulp.watch(resourceFilePath, { ignoreInitial: true }, common.syncResourceFile)
},
Expand Down Expand Up @@ -116,6 +124,6 @@ exports.electronMaker = async () => {
}

exports.clean = common.clean
exports.watch = gulp.series(common.syncResourceFile, common.syncAllStatic,
exports.watch = gulp.series(common.syncResourceFile, common.syncAssetFiles, common.syncAllStatic,
gulp.parallel(common.keepSyncResourceFile, css.watchCSS, common.keepSyncStaticInRt))
exports.build = gulp.series(common.clean, common.syncResourceFile, css.buildCSS)
exports.build = gulp.series(common.clean, common.syncResourceFile, common.syncAssetFiles, css.buildCSS)
2 changes: 0 additions & 2 deletions resources/js/excalidraw-assets/vendor-3525c448906ddcdcb701.js

This file was deleted.

6 changes: 4 additions & 2 deletions src/main/frontend/extensions/excalidraw.cljs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
(ns frontend.extensions.excalidraw
(:require ["@excalidraw/excalidraw" :as Excalidraw]
[cljs-bean.core :as bean]
(:require [cljs-bean.core :as bean]
[clojure.string :as string]
;; NOTE: Always use production build of excalidraw
;; See-also: https://github.com/excalidraw/excalidraw/pull/3330
["@excalidraw/excalidraw/dist/excalidraw.production.min" :as Excalidraw]
[frontend.config :as config]
[frontend.db :as db]
[frontend.handler.editor :as editor-handler]
Expand Down

0 comments on commit 54215ef

Please sign in to comment.