Beginner: Need some explanation

45 views
Skip to first unread message

chris...@olinger.eu

unread,
Dec 15, 2014, 8:24:14 AM12/15/14
to mimo...@googlegroups.com
Dear developer collegues,

I am new to using build tools and am trying out Mimosa. Unfortunately I fail to understand some key concepts and hoped somebody could help me out.

I have a nodejs server and use angular/express on client. I successfully run "mimosa watch -s". Below is my mimosa.config (My assets older is called client, I'll rename it eventually).
Now the questions:

- My app does not seem to serve from the public folder. Do I have to tell node or mimosa specifically that it should do it? I still have "client" harcoded in my server.js. Maybe it is that?

app.set('view engine', 'jade');
app.set('views', __dirname + '/client/javascripts/core');
app.use(express.static(path.join(__dirname, 'client')));

- I tried replacing "client" with "public" but then my browser complains about not finding the index view.
- Where do I load the template.js which contains my compiled jade files
- Do I need to add requirejs to my project?

I hope I do not sound too confused, but I am a bit.

Best regards,

Christophe







-----------------------
Mimosa config

exports.config = {
"modules": [
"copy",
"jshint",
"csslint",
"server",
"require",
"minify-js",
"minify-css",
"live-...@1.1.4",
"bower",
"jade",
"server-reload",
"web-package"
],
"watch": {
"sourceDir":"client",
"exclude":[/[/\\](\.|~)[^/\\]+$/, /.ejs$/]
},
"logger":{
"growl": {
"enabled": false
}
},
"server": {
"views": {
"path":"client/javascripts/core"
},
"path":"server.js"
},
"liveReload": {
"enabled":false
},
"serverReload": {
"watch":["server.coffee", "server.js", "server.ls", "server.iced", "routes", "src", "lib", "server", "config"],
"exclude":[],
"validate":true
},
"webPackage": {
"archiveName": "app",
"configName": "config",
"useEntireConfig": false,
"outPath": "dist",
"exclude": ["README.md", "node_modules", "mimosa-config.coffee", "mimosa-config.js", "assets", ".git", ".gitignore", "mimosa-config-documented.coffee", ".mimosa", "bower.json"],
"appjs": "app.js"
}
}

dbashford

unread,
Dec 15, 2014, 12:25:11 PM12/15/14
to mimo...@googlegroups.com, chris...@olinger.eu
- So you have specifically pointed your express app at your source folder.  You'll want to point it at the public folder. You can do that using the config.  Here's an express app from an Ember skeleton for example: https://github.com/dbashford/MimosaEmberSkeleton/blob/master/server.js#L26 Notice it just uses: config.watch.compiledDir, which is good because if you decide to change that you won't have to change your express server.

- What index view is it trying to find?

- The template.js file with your compiled templates is placed inside public/javascripts.

- You do not NEED to use requirejs, but if you are not going to use it, you will want to remove the require module from the modules list.

chris...@olinger.eu

unread,
Dec 16, 2014, 3:46:53 AM12/16/14
to mimo...@googlegroups.com, chris...@olinger.eu
Thanks dbashford, that helped a lot. I now see my files served from the public folder. I wasn't sure whether there was some magic somewhere in mimosa that would give the compileDir to my nodejs server via the config in startServer.

The thing with template.js is not that I can not find it, but I see in none of the skeletons that it is loaded manually. I have a bunch of includes in my index.jade for lots of jade partials. I was wondering whether the template.js script would replace those?

Best regards,

Christophe

P.S. I am also the one that had problems with multiple websockets of which one was going via http-proxy to a python websocket. I'll raise this issue with the http-proxy guys to see how I can differentiate the mimosa socket from my usual one and not have the fromer proxied as well.

GMail

unread,
Dec 16, 2014, 7:48:19 AM12/16/14
to mimo...@googlegroups.com, chris...@olinger.eu
The Jade you are doing, is it server or client side jade?

Sent from my iPhone
> --
> You received this message because you are subscribed to the Google Groups "mimosajs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to mimosajs+u...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Christophe Olinger

unread,
Dec 16, 2014, 8:12:14 AM12/16/14
to GMail, mimo...@googlegroups.com
My index page in the views folder is jade. So are my 404 and 401 pages. My angular app loads some partials that are also in jade, but those are not in my views folder. They reside with the modules. So I guess my jade is bot client and server side.
On further inspection, my views folder simply disappears in the public folder. I just realized that when using web-package. In the dist folder, the assets folder is no longer available and thus there is no views folder anywhere and my browser complains about not finding my index file. I think I am doing something fundamentally wrong since there is no place that I could load my templates.js if the index.jade file is never found.
All code runs fine if using mimosa watch -s, but, as I said, the public folder does not have a views folder.
Sorry for the newb nuisance.

GMail

unread,
Dec 16, 2014, 8:22:25 AM12/16/14
to Christophe Olinger, mimo...@googlegroups.com
So you have an "assets/views" that contains your server templates?  And it's the index and 40X templates are disappearing (because they are getting bundled into templates.js)?

Sent from my iPhone

Christophe Olinger

unread,
Dec 16, 2014, 8:25:28 AM12/16/14
to GMail, mimo...@googlegroups.com
Yes, along my partials which reside in other folders, but disappear in the compile folder. I am not using requirejs, and wrapTpye of templates is none. I guess I do not know where to load the templates.js. Maybe I'll have to use requirejs and ut the templates.js in the requirejs config js?
Reply all
Reply to author
Forward
0 new messages