dbashford / mimosa-client-jade-static

A mimosa module to use jade to create HTML client templates
2 stars 4 forks source link

Enhancement Suggestion: Dynamically add html extension to relative jade paths #5

Open mattsintellectualproperty opened 10 years ago

mattsintellectualproperty commented 10 years ago

Quick idea or question I had: How hard would it be to add a flag that would dynamically add file name extensions to hrefs in templates when server-template-compile? I really like using Jade to build my templates, but most of my clients need me to export this as packages of static files to show progress and it can't go up on a private server either.

Would there be a way to add a property in the configuration for adding the .html file extension dynamically to hrefs in output templates?

Thanks!

dbashford commented 10 years ago

May have lost me a little. Could you give me a concrete example?

mattsintellectualproperty commented 10 years ago

For example, output html looks like this:

<ul>
                <li><a href="screener">Screener</a>
                </li>
                <li><a href="company-profile">Company Profile</a>
                </li>
                <li><a href="financials">Financials</a>
                </li>
</ul>

But would be great if relative urls compiled to this:

<ul>
                <li><a href="screener.html">Screener</a>
                </li>
                <li><a href="company-profile.html">Company Profile</a>
                </li>
                <li><a href="financials.html">Financials</a>
                </li>
</ul>

Does this makes sense, or if this is OOTB functionality and I'm overlooking something?

dbashford commented 10 years ago

You mentioned server-template-compile, but is it a client-jade-static issue too?

I'll need to whip something together to see what the deal is. I'm surprised it would lop off the extension?

mattsintellectualproperty commented 10 years ago

I'll check if it happens on Jade templates to, but it definitely is happening on html templates.

It's not cutting off the extension, but I'm just saying it would be nice to have a flag to apply the extension, for example, if I want to dev in an app of jade templates, but be able to export this as a static html deliverable that links within itself for less-techy clients.

Does that make sense? I'll try and get around to testing this out in Jade tonight.

dbashford commented 10 years ago

Sorry, the reason I asked was because you logged the issue in client-jade-static, but mention server-template-compile

mattsintellectualproperty commented 10 years ago

Yeah, I put it in here because I figured it was functionality that people who use this module would want, but it happens across the board with this and server-template-compile from testing with a new install.

Here's a repo simulating the issue. https://github.com/boltforge/test-repo

Checking out the repo or doing Install steps 5, 2, 7, 1, 1, and creating a link in the index pointing to the route rather than the compiled .html will show you what I mean.

dbashford commented 10 years ago

In that test repo this is your mimosa-config...

exports.config = {
    "modules": [
        "copy",
        "server",
        "jshint",
        "csslint",
        "require",
        "minify-js",
        "minify-css",
        "live-reload",
        "bower",
        "stylus",
        "html-templates",
        "server-template-compile",
        "web-package",
        "combine",
        "stream-copy",
        "import-source"
    ],
    "clientJadeStatic": {
        "context": {},
        "outputExtension": '.html',
        "prettyOutput": true
    },
    ...
};

You have server-template-compile in your modules, but you have configured clientJadeStatic. The latter isn't in your modules.

mattsintellectualproperty commented 10 years ago

Yeah, you are right sir. Added it but still no success. So should this be closed and moved to https://github.com/dbashford/mimosa-server-template-compile?

dbashford commented 10 years ago

I'm having trouble understanding which behavior I should be diagnosing.

You are using clientJadeStatic config in there. So should I change the module to client jade static and play with that?

Is the client side compilation of jade that needs this or the server side? On the server you have absolute control over that. I'm pretty sure you can have your server routes respond to index.html and render jade views, and then have links that that point to .html.