Giter VIP home page Giter VIP logo

Comments (7)

lukeapage avatar lukeapage commented on June 4, 2024

How do we reference something defined in the yml in a template..

is there any good documentation or quick start on the hbs file and yml integration and how that works? Not asking you to write loads, just if it exists, otherwise I'm sure I'll pick it up.

from less-docs.

jonschlinkert avatar jonschlinkert commented on June 4, 2024

Yeah, it's this simple:

In the Gruntfile, the _config.yml file is namespaced under the site variable, so for any property in _config.yml, you just do:

{{site.foo}}

Data from other JSON or YAML files are referenced by the name of the file. So, using a generic example, button.json containing the following:

{
  "text": "Click me"
}

Would be used in a template like this:

{{button.text}}

from less-docs.

jonschlinkert avatar jonschlinkert commented on June 4, 2024

So in other words, I'm using _config.yml namespaced uner site for "site wide" data, since it's a familiar convention to many users of Jekyll. But any other data files used for other "components" or areas of the site will generally use the same name as the template they belong to, which makes it super easy to maintain. E.g.:

nav.hbs (template) would be matched up with nav.json data file. Inside nav.hbs, {{nav.foo}} would be used to get data from nav.json.

Another example is less.json, which is generated by this script, allowing us to update the documentation with current info from the less.js repo, such as version, with just {{less.version}}, and so on.

Also, I created this data file for functions, but I'd like to have one of these for all features. Eventually it will include something like:

{
  "name": "feature-name",
  "data": { // this object would contain any "reference" data, or fixtures, required by the example(s) },
  "example": "this would be an example of the feature",
  "expected": "this would be the compiled result",
  "desc": "This is a description of the feature."
}

from less-docs.

kaleb avatar kaleb commented on June 4, 2024

The CDN link <script src="//cdnjs.cloudflare.com/ajax/libs/less.js/2.0.0-b2/less.min.js"></script> 404s.

from less-docs.

seven-phases-max avatar seven-phases-max commented on June 4, 2024

@kaleb See #253. Some desync for links of new releases (especialy if it's beta) is expected since neither the docs nor cdnjs are updated immediately. You always can find the latest version available at cdnjs by visiting https://cdnjs.com/libraries/less.js.

from less-docs.

lukeapage avatar lukeapage commented on June 4, 2024

I'm making a pull request to cdnjs to fix..

from less-docs.

SomMeri avatar SomMeri commented on June 4, 2024

cdn is now defined in .assemblerc.yml.

from less-docs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.