# Shell config #26

Merged
merged 6 commits into from Apr 21, 2016

## Conversation

Projects
None yet
3 participants
Owner

### Engil commented Apr 15, 2016 • edited

 Hey everyone ! Following the discussions on #17, this PR introduce a few changes: First, the style.sh has been removed and now everything happens inside config.ml thanks to a few advices from Drup on IRC. This is really nicer, allowing to write a bit of logic without suffering from any shell language and adding assets configuration at the same level of the unikernel configuration. Second, the JS libs are now retrieved using npm instead of bower. package.json contains the various JS dependencies, and everything is bundled inside a single JS file using browserify. The main entrypoint is located inside assets/js/main.js, so if anyone want to add a random JS lib to their Canopy instance, they just need to add the dependency inside package.json, add the correct call in the JS entrypoint and everything should be alright. (and I will remove the --mathjax option in the process since adding random JS lib is now simpler) One other thing is that now, if the user don't have lessc, browserify and npm inside the PATH, Canopy will decompress a tarball located in assets containing already fetched and compiled assets… I'm not really fond of this option, there is a need to allow user to not run npm and stuff on their machine to get started but I don't like the idea to keep this file under the repository by fear of it getting forgotten and not re-generated everytime something changes. I think a got most of the changes of this branch covered here, so if you have any feedback, please don't hesitate. (I'm not sure if all the commands running in the new config.ml will work everywhere for example, it should work on Linux and OSX, not sure about FreeBSD… @hannesm ?) (and also, this branch add highlight.js by default 🎉)

### Engil added some commits Apr 15, 2016

 Replace style.sh by a custom device in config.ml 
 168df9a 
 Revert CI build to unix only for now 
 269f24e 
 Now if less, npm and browserify are not found, used a local tarbal co… 
…ntaining already compiled assets
 7e682e9 
 Remove padding in code blocks 
 ada1822 

### wiredsister commented Apr 15, 2016

 Awesome @Engil. Kudos. I'll respond more meaningfully after I play with it and see the changes.

### Engil added some commits Apr 16, 2016

 Remove --mathjax 
 fb5ca03 
 Remove .bowerrc 
 b39c9c9 
Owner Author

### Engil commented Apr 21, 2016

 I think I will merge this to avoid keeping too many PR around, but if you have some feedbacks please don't hesitate. :)

### Engil merged commit 6a606d5 into master Apr 21, 2016 2 checks passed

#### 2 checks passed

continuous-integration/travis-ci/pr The Travis CI build passed
Details
continuous-integration/travis-ci/push The Travis CI build passed
Details

### hannesm reviewed Apr 24, 2016

 (Printf.printf "npm, browserify and lessc not found… decompressing from assets/assets_generated.tar.gz\n"; run "tar -xf assets/assets_generated.tar.gz") method clean i = Functoria_app.Cmd.run "rm -r node_modules disk"

#### hannesm Apr 24, 2016

Collaborator

if node_modules and/or disk is not present, this leads to mirage clean failing... would be better to run the rm here only if the directories are present...

Collaborator

### hannesm commented Apr 24, 2016

 crunch (which is called by generic_kv_ro since default kv_ro key is crunch) doesn't cope well with the 500KB JavaScript. I tried Archive and Fat as well without success (in a xen environment). Now I put the JS on another host, and edited canopy_templates with the url... this is not really optimal (but not really Canopy's fault, I suspect someone needs to walk through persistency in MirageOS (seems to be broken on various ends atm))