Coder Social home page Coder Social logo

module.shadow-cljs's Introduction

Duct module.shadow-cljs

Clojars Project

A Duct module for compiling and dynamically reloading ClojureScript files using shadow-cljs.

Installation

To install, add the following to your project :dependencies:

[g7s/module.shadow-cljs "0.1.2"]

Usage

This library provides the :duct.module/shadow-cljs key, and accepts the same options as shadow-cljs as well as an (optional) :logger top-level key that is a :duct/logger that will be used to log information about your builds in development.

Additionally it defines two other keys namely :duct.server/shadow-cljs and :duct.compiler/shadow-cljs.

Server

The server key :duct.server/shadow-cljs is used to start a shadow-cljs server for use in the development phase of your project. If you want to make changes in the main :duct.module/shadow-cljs you should use this key in your development profile configuration.

Compiler

The compiler key inherits from :duct/compiler and it is used only when compiling your code for a release. If you want to make changes in the main :duct.module/shadow-cljs you should use this key in your production profile configuration.

Example

Example module configuration:

:duct.module/shadow-cljs
{:builds
 {:app
  {:target     :browser
   :output-dir "target/resources/my/app/web/public/js"
   :asset-path "/js"
   :devtools   {:watch-dir      "resources/my/app/web/public"
                :watch-options  {:verbose   true
                                 :autobuild true}
                :browser-inject :common}
   :modules
   {:base {:entries [cljs.core]}

    :common {:entries    [my.app.utils]
             :depends-on #{:base}}

    :mod {:entries    [my.app.mod]
          :depends-on #{:common}}

    :mod-worker {:entries    [my.app.mod.worker]
                 :depends-on #{:base}
                 :web-worker true}

    :pages {:entries    [my.app.pages]
            :depends-on #{:common}}}}}}

Override in development profile:

:duct.server/shadow-cljs
{:logger           #ig/ref :duct/logger
 :compiler-options {:output-feature-set :es5}
 :builds
 {:app
  {:closure-defines {goog.DEBUG true}
   :devtools        {:preloads [devtools.preload]}}}}

License

Copyright © 2020 Gerasimos

Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.

module.shadow-cljs's People

Contributors

g7s avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

module.shadow-cljs's Issues

[thheller/shadow-cljs "2.11.13"] doesn't work

When upgrading to [thheller/shadow-cljs "2.11.13"] I get the following error:

Syntax error (IllegalArgumentException) compiling . at (shadow/build/data.clj:342:5).
No matching method sha1Hex found taking 1 args for class org.apache.commons.codec.digest.DigestUtils

With the following config:

 :duct.module/shadow-cljs
 {:builds {:app
           {:target :browser
            :nrepl {:middleware [refactor-nrepl.middleware/wrap-refactor]}
            :modules {:main {:entries [blogger.core]}}
            :devtools {:watch-dir "resources/blogger/public"
                       :before-load blogger.core/suspend!
                       :after-load blogger.core/resume}
            :output-dir "resources/blogger/public/js/compiled"
            :compiler-options {:infer-externs :auto}}}}

Downgrading to [thheller/shadow-cljs "2.8.90"] resolves this, but that's not a great solution.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.