From d39a36988c0c1508b4502fdcc42019a8bf80e5eb Mon Sep 17 00:00:00 2001 From: Jeremy Dormitzer Date: Fri, 16 Feb 2018 11:56:54 -0500 Subject: [PATCH] Enable Figwheel for background and sidebar scripts in dev build --- .gitignore | 3 ++- Makefile | 5 +++-- project.clj | 35 +++++++++++++++++++---------------- resources/dev/manifest.json | 2 +- 4 files changed, 25 insertions(+), 20 deletions(-) diff --git a/.gitignore b/.gitignore index f5df669..39a56ba 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,5 @@ pom.xml.asc .cljs_rhino_repl dist ext -**/js/generated \ No newline at end of file +**/js/generated +figwheel_server.log \ No newline at end of file diff --git a/Makefile b/Makefile index b28408c..9337b5d 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,13 @@ dev : - lein cljsbuild once mkdir -p ext cp -R resources/shared/* resources/dev/* ext/ + lein cljsbuild once content + lein figwheel background sidebar prod : - lein with-profile prod cljsbuild once mkdir -p ext cp -R resources/shared/* resources/prod/* ext/ + lein with-profile prod cljsbuild once rm -rf ext/js/generated/out-* package : clean prod diff --git a/project.clj b/project.clj index 1ba7330..1d8eecf 100644 --- a/project.clj +++ b/project.clj @@ -28,43 +28,46 @@ {:cljsbuild {:builds {:background - {:compiler {:optimizations :none - :output-to "resources/dev/js/generated/background.js" - :output-dir "resources/dev/js/generated/out-background" + {:figwheel true + :compiler {:optimizations :none + :output-to "ext/js/generated/background.js" + :output-dir "ext/js/generated/out-background" :asset-path "js/generated/out-background" :pretty-print true :source-map true}} :content {:compiler {:optimizations :whitespace - :output-to "resources/dev/js/generated/content.js" - :output-dir "resources/dev/js/generated/out-content" + :output-to "ext/js/generated/content.js" + :output-dir "ext/js/generated/out-content" :pretty-print true - :source-map "resources/dev/js/generated/content.js.map"}} + :source-map "ext/js/generated/content.js.map"}} :sidebar - {:compiler {:optimizations :none - :output-to "resources/dev/js/generated/sidebar.js" - :output-dir "resources/dev/js/generated/out-sidebar" + {:figwheel true + :compiler {:optimizations :none + :output-to "ext/js/generated/sidebar.js" + :output-dir "ext/js/generated/out-sidebar" :asset-path "js/generated/out-sidebar" :pretty-print true - :source-map true}}}}}] + :source-map true}}}} + :plugins [[lein-figwheel "0.5.14"]]}] :prod [:cljs-shared {:cljsbuild {:builds {:background {:compiler {:optimizations :simple - :output-to "resources/prod/js/generated/background.js" - :output-dir "resources/prod/js/generated/out-background" + :output-to "ext/js/generated/background.js" + :output-dir "ext/js/generated/out-background" :pretty-print false :source-map false}} :content {:compiler {:optimizations :simple - :output-to "resources/prod/js/generated/content.js" - :output-dir "resources/prod/js/generated/out-content" + :output-to "ext/js/generated/content.js" + :output-dir "ext/js/generated/out-content" :pretty-print false :source-map false}} :sidebar {:compiler {:optimizations :simple - :output-to "resources/prod/js/generated/sidebar.js" - :output-dir "resources/prod/js/generated/out-sidebar" + :output-to "ext/js/generated/sidebar.js" + :output-dir "ext/js/generated/out-sidebar" :pretty-print false :source-map false}}}}}]}) diff --git a/resources/dev/manifest.json b/resources/dev/manifest.json index 2523a17..a624234 100644 --- a/resources/dev/manifest.json +++ b/resources/dev/manifest.json @@ -25,7 +25,7 @@ ] } ], - "content_security_policy": "script-src 'self' 'unsafe-eval' 'sha256-CfMPE8ys/ylJ5D9qKG0a9/UejrcczMr4/EmFCbVbgcc=' 'sha256-XsBu2nEJnS7x/Izq1v7dzy3Ze5myJMHvg4zukh/R1Yk=' 'sha256-AUCho1UyOpYFSZDg8EM9SYlysRIrUpQKZ7iE9CFSYfU=' 'sha256-vLlTaRFN8A2FPadIx711FwK9Ytd6LXkAzuEYAdC0D1k='; object-src 'self'", + "content_security_policy": "script-src 'self' 'unsafe-eval' 'sha256-CfMPE8ys/ylJ5D9qKG0a9/UejrcczMr4/EmFCbVbgcc=' 'sha256-XsBu2nEJnS7x/Izq1v7dzy3Ze5myJMHvg4zukh/R1Yk=' 'sha256-AUCho1UyOpYFSZDg8EM9SYlysRIrUpQKZ7iE9CFSYfU=' 'sha256-vLlTaRFN8A2FPadIx711FwK9Ytd6LXkAzuEYAdC0D1k=' 'sha256-pGPwkltLPS11ByeZ61wzrzfELAOibrYCIFYF/TaXVdk='; object-src 'self'", "permissions": ["tabs", "https://hn.algolia.com/*"], "web_accessible_resources": ["sidebar.html", "js/*.map", "js/generated/*.map", "js/generated/out/*"] }