Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor templates.json files to better match Swig template inheritance behavior #7

Open
fdelaneau opened this issue Feb 13, 2021 · 0 comments

Comments

@fdelaneau
Copy link
Collaborator

fdelaneau commented Feb 13, 2021

The behavior should be more like the Swig templating inheritance where a declared bloc replaces the default values unless explicitly declared.

// Common rules applied by default to all pages
"*": {
    "routeNameAsFilenameEnabled": true,
    "http-metas": {
      "content-type": "text/html"
    },
    "stylesheets": [
        {
            // "media": "screen", // optional - default: all
            "url": "/css/public.css"
        }
    ],
    "javascriptsDeferEnabled": true,
    "javascripts": [
        "/js/vendor/modernizr-2.8.3.min.js",
        "/js/tooltip.js",
        "/handlers/main.js"
    ]
},

// Specific rules for one page or section : WITHOUT stylesheets inheritance
// The stylesheet page.css will replace public.css while the rest of the rules are inherited (routeNameAsFilenameEnabled, http-metas, javascriptsDeferEnabled , javascripts)
"exempleWithoutInheritance": {
    "stylesheets": [
      {
        "url": "/css/page.css"
      }
    ]
},

// Specific rules for one page or section : WITH stylesheets inheritance
// The page stylesheets will be public.css followed by other-pages.css 
// Reversing the declaration order will also reverse the order in the final html page
"exempleAvecHeritage": {
    "stylesheets": [
    {
        "parent": "*",
        "url": "/css/other-page.css"
      }
    ]
}
@fdelaneau fdelaneau changed the title Refactoring des fichiers templates.json Refactor templates.json files to better match Swig template inheritance behavior Feb 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant