Comments (3)
I've tweaked the cljsbuild
section to include the following
{:id "nodejs"
:source-paths ["src/cljs" "src/cljc" "dev"]
:compiler {:main cljs.user
:target :nodejs
:asset-path "js/compiled/out"
:output-to "resources/public/js/compiled/nodejs/nodejs.js"
:output-dir "resources/public/js/compiled/nodejs"
:source-map-timestamp true}}
from chestnut.
I've started to work on a seperate branch with chestnut/master
as base here https://github.com/abhi18av/devnagri-ui-tests/tree/node-repl
I've made progress with the configuration here
{:id "nodejs"
:source-paths ["src/nodejs" "src/cljc" ]
:compiler {:main cljs.user
:target :nodejs
;:asset-path "js/compiled/out"
:output-to "resources/public/js/compiled/nodejs/nodejs.js"
:output-dir "resources/public/js/compiled/nodejs"
:pretty-print true
:optimizations :simple
;:optimizations :advanced :simple :whitespace :none
:parallel-build true
:npm-deps {"chalk" "2.1.0"}
:install-deps true
;:source-map-timestamp true
;:source-map true
:warnings false}}
And the code in src/nodejs/devnagri_ui_tests/nodejs.cljs
is as follows
(ns devnagri-ui-tests.nodejs
(:require [clojure.string :as str]
[cljs.nodejs :as nodejs]))
(nodejs/enable-util-print!)
(defn -main [& args]
(-> (str/join " " args)
(str/replace #"cker\b" "xor")
(str/replace #"e|E" "3")
(str/replace #"i|I" "1")
(str/replace #"o|O" "0")
(str/replace #"s|S" "5")
(str/replace #"a|A" "4")
(str/replace #"t|T" "7")
(str/replace #"b|B" "6")
(str/replace #"c|C" "(")
println))
(set! *main-cli-fn* -main)
But running the node
on the output
doesn't print out anything at all
❯ npm test
> [email protected] test /Users/eklavya/Projects/ProjectEklavya/BlueCollar/devnagri-ui-tests
> /Users/eklavya/.nvm/versions/node/v8.1.3/bin/node resources/public/js/compiled/nodejs/nodejs.js
The expected output is as follows
$ l33t I am a leet hacker
1 4m 4 l337 h4x0r
This is taken from blog-post by plexus here https://lambdaisland.com/blog/02-05-2017-nodejs-scripts-clojurescript
from chestnut.
Hey there!
The one issue I was running into with your code specifically was that your version of clojurescript didn't seem to like compiling node. The following worked:
[org.clojure/clojurescript "1.9.946" :scope "provided"]
.
Your cljs main should probably also be devnagri-ui-tests.nodejs
:
{:id "nodejs"
:source-paths ["src/nodejs" "src/cljc" ]
:compiler {:main devnagri-ui-tests.nodejs
:target :nodejs
;:asset-path "js/compiled/out"
:output-to "resources/public/js/compiled/nodejs/nodejs.js"
:output-dir "resources/public/js/compiled/nodejs"
:pretty-print true
:optimizations :simple
;:optimizations :advanced :simple :whitespace :none
:parallel-build true
:npm-deps {"chalk" "2.1.0"}
:install-deps true
;:source-map-timestamp true
;:source-map true
:warnings false}}
In the future, this kind of thing would be ideal to bring up in the mailing list or on the clojurian slack, not as an issue here.
from chestnut.
Related Issues (20)
- Sass compiling doesn't work HOT 1
- om/om.next HOT 4
- Calling `(reset)` at the cljs-repl causes the system to be completely dropped HOT 2
- Trouble setting up HOT 2
- Figwheel version might need to be updated to latest HOT 7
- cider-cljs-lein-repl is obsolete (since 0.17); use ‘cider-default-cljs-repl’ instead HOT 1
- [Version 0.16.0 (67651e9d)] index.html references inexistent .js file, figwheel version inconsistency HOT 11
- Error when starting the application HOT 3
- Heroku procfile out of date HOT 1
- java.io.FileNotFoundException: Could not locate my_app/server__init.class or my_app/server.clj on classpath HOT 3
- Unrecognized option: +bidi HOT 2
- REPL server launch timed out HOT 4
- Figwheel CIDER middleware doesn't seem to be working. HOT 2
- Unable to resolve var: cider.piggieback/wrap-cljs-repl in this context HOT 5
- Repl never prompts HOT 11
- (go) has to be called every time a route is changed. HOT 1
- (go) not working (on repeat) HOT 1
- Cannot use resources folder in cljs. HOT 3
- (go) does not work in an Emacs CIDER REPL
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chestnut.