Giter VIP home page Giter VIP logo

less-docs's Introduction

lesscss.org

CI Status GH Status npm version Twitter Follow Author

Official website and documentation for Less/Less.js

Quickstart

Assemble and Grunt are used to build the docs. To get started:

  1. Download the docs
  2. In the root of the project, run npm install
  3. Run the grunt command to build the docs

If all worked properly, you're ready to begin contributing to the docs!

Documentation

All documentation content can be found in the ./content directory. Please read the contributing section below if you wish to add documentation.

The Plan

  1. Clean up and organize all of the documentation in the content directory, which means
  2. Consistent naming conventions for files, consistent coding styles in documents
  3. Organize information and favor individual files for sections of content, rather than long documents
  4. Last, a new theme.

Contributing

Coding Style

Please help us make the documentation consistent, readable, and maintainable by conforming to these guidelines when contributing:

Less, LESS or Less.js?

The name of the project is Less. Anywhere in the docs, Less means both the language and its official, reference implementation. The less.js form is normally to be used only to specify either of:

  • the browser script file name
  • the particular GitHub repository (where most of the development takes place)
Examples:
  • "Less language", "Less library", "Less API", "Less plugin", "Using Less" etc.
  • "Fork less/less.js repository" (synonyms: "Less Repository", "Main Repository" etc.)
  • "Make sure to include your stylesheets before the less.js script"

Capitalization

In Titles: Do Capitalize
  • Nouns (man, bus, book)
  • Adjectives (angry, lovely, small)
  • Verbs (run, eat, sleep)
  • Adverbs (slowly, quickly, quietly)
  • Pronouns (he, she, it)
  • Subordinating conjunctions (as, because, that)
In Titles: Do Not Capitalize
  • Articles: a, an, the
  • Coordinating Conjunctions: and, but, or, for, nor, etc.
  • Prepositions: on, at, to, from, by, etc.

Markdown standards

  • Use # for titles, not underlines. Underlines are not semantic, aren't as flexible, aren't always highlighted properly in code highlighters
  • Always add a space between the # and the heading
  • Wrap inline code with a single backtick,
  • wrap blocks of code with three backticks (code fences).
  • With code blocks, always use the correct language after the first code fence. Although GitHub does not highlight Less, our documentation is more likely to show up in GitHub's and Google's search results when the correct language is used. Examples: please use ```less for Less, and ```css for CSS.

Less standards

  • Two spaces for indentation, never tabs, and always use proper indentation
  • Multiple-line formatting (one property and value per line)
  • For multiple, comma-separated selectors, place each selector on its own line
  • Double quotes only, never single quotes
  • Always put a space after a property's colon (e.g., display: block; and not display:block;)
  • End all lines with a semi-colon
  • Attribute selectors, like input[type="text"] should always wrap the attribute's value in double quotes. This is important to do in your own code as well for consistency and safety (see this blog post on unquoted attribute values that can lead to XSS attacks)
  • When using HTML in your examples, use tags and elements appropriate for an HTML5 doctype (e.g., self-closing tags with no trailing slash)
  • Separate words in variable and mixin names using dash (e.g., @long-variable-name or .my-favourite-mixin)

Examples:

Good

body {
  padding-top: 80px;
  font-size: 12px;
}

Bad

body {
padding-top: 80px;
font-size: 12px;
}

Bad

body { padding-top: 80px; font-size: 12px }

Also, please ensure that all documentation files should have globally-unique names, regardless of where they are located in the repository. This makes it easier to use conveniences like file globbing, and it's good practice anyway.

Feature Requests, Bugs and Pull Requests

  • If you would like to request a feature, suggest an improvement, or report a bug, please submit an Issue.
  • Feature requests are more likely to get attention if you include a clearly described use case.
  • If you wish to submit a pull request, please read this first.

Tools

The documentation site is generated using Assemble. Please visit that project to report bugs, or to learn more about usage and customization.

Build the docs

Update the project with the most recent metadata from the Less.js project, such as current version number, description, and so on, and then run Grunt with the following command:

node data/_utils/pkg && grunt

License

Copyright (c) 2022, Alexis Sellier, Less Core Team, Contributors Documentation released under Creative Commons. Documentation source code released under the MIT License. Less source code is released under the Apache 2 License.

less-docs's People

Contributors

altschuler avatar bassjobsen avatar capnslipp avatar carwin avatar dependabot[bot] avatar dspdesign avatar dvijayak avatar gossi avatar ichenlei avatar jonschlinkert avatar justineo avatar kamilmielnik avatar king2500 avatar lammertw avatar ldetomi avatar lukeapage avatar matthew-dean avatar mishal avatar nreilingh avatar pixelass avatar reggi avatar rm-bergmann avatar sethlilly avatar seven-phases-max avatar simonguo avatar sommeri avatar synchro avatar talhafaroow33 avatar tmccombs avatar zlatanvasovic avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

less-docs's Issues

styleguide for docs

Just to get this started:

Markdown

  • Use GitHub Flavored Markdown
  • For code examples, use fenced code blocks with language definitions, versus indentation
  • Use hashes for headings (###), not dashes

Resources

LESS code examples

  • All code in examples is indented by 2 spaces
  • Always spaces, never tabs
  • Always end lines with a semicolon
  • One property per line
  • Add a space after colons, do this color: #900, not this color:#900

Resources

tip: scoping variables with & { ... }

Here is a trick I use to define variables and keep them in some private scope, avoiding them leaking to the global space.

& {
  // Vars
  @height: 100px;
  @width: 20px;
  // Don't define any prop:value on this scope (as doing so will generate (wrong) output).

  .test {
    height: @height;
   width: @width;
  }
}

.rest {
  height: @height; // Name error: variable @height is undefined
}

Here, @height and @width are only defined for the scope created by & { ... }
You can also nest an scope inside a rule:

.some-module {
  @height: 200px;
  @width: 200px;
  text-align: left;
  line-height: @height; // 200px

  & {
    // Override original values
    @height: 100px;
    @width: auto;

    .some-module__element {
      height: @height; // 100px
      width: @width; // 200px
    }

    .some-module__element .text {
      line-height: (@height / 2); // 50px
    }
  }

  & {
    // Override original values
    @height: 50px;

    .some-module__another-element {
      height: @height; // 50px
      width: @width; // 200px
    }

    .some-module__another-element .text {
      line-height: (@height / 2); // 25px
    }
  }
}

Documentation API

Are we planning to have an API for individual pieces of documentation? (So that someone can, say, look up a function in an editor?) ;-)

Side menu for usage

and maybe organise usage a bit.

Options
Advanced Server Side
How to use sourcemaps
Advanced Client Side

Spelling error

Examples: pleas use lessfor LESS, andcss for CSS. Change it to please. Markdown Standards

Documentation missing on creating a custom importer or fileLoader

A number of questions come up for creating custom file handlers (like pulling less files from a DB backend, or a different file retrieval system). However, I can't seem to find any documentation or Github threads on how to create a file loader or an importer (and what the difference between these two actually is).

I found a note from @lukeapage on one thread saying he'd refactored parsing and added fileLoader, but I'm still not quite sure what it does, or when to override it instead of overriding importer.

This could be part of a documentation section on extending Less, or the Less "API".

What GUI Compilers should we mention in the docs?

E.g. #1242

Can we mention Visual Studio's Web Essentials extension under GUI compilers that use LESS.js?

I was almost about to add it to GUI-compilers-that-use-LESS but then I thought "Hey! These days almost every less or more popular IDE/editor supports LESS natively or via plugins/extensions, should we add them all? There're a lot!" (and most of them do that via lessc or less.js).

So far the list contains almost only less or more "less/sass/css dedicated" GUI editors/compilers. So I wonder if we need some special rules on what may be added there and what might be not.

"Color Operations" -> "Color Adjustment(s)" (functions)?

Well, not every function there is actually an adjustment one (e.g. contrast) but most are. This is subjective of course but for me "operations" always looked a bit weird (confusing with some kind of arithmetic operations or so). I came to this idea when I was doing some coding for future PRs (e.g. not ready yet) and there those functions just scream "rename us!" :) (though the internal naming in the code is no way related to the docs so this is just a source of inspiration).

Responsive design

Given how easy it is to do inline media queries in LESS, the site is not responsive and requires tedious pinch-zooming on mobile.

There really should be a mobile styles.

Mixins as Functions

See #34. I don't think my English will let me to finish it so please do not hesitate to take over.

Annotated source

To compliment the proposed improved contributing docs, it might be a good idea to have annotated source code. For example:

CoffeeScript: http://coffeescript.org/documentation/docs/grammar.html
Underscore: http://underscorejs.org/docs/underscore.html

Both use Docco to process the source and produce this beautiful documentation.

http://jashkenas.github.io/docco/

There's also Python, Ruby, shell and .NET versions.

http://fitzgen.github.com/pycco
https://github.com/rtomayko/rocco
http://rtomayko.github.com/shocco/
http://dontangg.github.com/nocco/

Add CHANGELOG to website

(Most of these suggestions are based on #1 from @ChrisCinelli)

  • add CHANGELOG to website
  • Move release update from the top to a new section called "Changelog". Possibly at the end of the page. The focus of the content of the site should always be related to the most current version. All mention of other versions should be in the changelog or "release history" section.
  • Bonus: put for each version number in changelog a link to the documentation of that version. Unfortunately https://github.com/cloudhead/lesscss.org does not have tag for different version but I think they could be retrieved with a little work. From now on I would tag the new versions of the page.

setup google analytics

  • setup virtual page views and events for tracking behavior -- assuming we stick with a single page for most of the docs.

The analytics would be easier easier to maintain (for others in the future) if we split up the site into multiple pages. Visits on multiple pages are straightforward and easy to track (something like http://assemble.io/docs/Home.html). I suppose we'll just see how it goes...

  • add @cloudhead as admin on analytics repo. (or, @cloudhead if you have an account you'd like to use, I'm good with whatever you want to do)

Document & when () {}

document that you can now use

& when() {
}

as a way of essentially doing if's as syntactic sugar for

.if() when () {
}
.if();

Mis-leading "client-side" text

I still think this is misleading on the website:

LESS runs on both the server-side (with Node.js and Rhino) or client-side (modern browsers only).

Everyone I know in web-development would assume that saying "LESS runs client-side" means it's good to go for production, when what we (currently) mean here is that you can test it in the browser.

How about:

LESS compiles on the server-side (with Node.js, Rhino, and others), or you can easily try it client-side (on modern browsers).

"Try" implying "testing"

Poor description text

When pasting to LinkedIn, lesscss.org auto-generated this description text:

Are some elements in your style sheet proportional to other elements? Operations let you add, subtract, divide and multiply property values and colors, giving you the power to create complex relationships between properties. Operations should only be performed within parentheses in order to ensure compatibility with CSS.

I recommend we clean up meta tags on the site (and add appropriate ones for Twitter cards and Facebook posts) to make the site more friendly to pasting on various social platforms.

&& isn't explained

Moved from less.js issue less/less.js#1652 Original description:

Until recently I didn't knew about && as a placeholder for selectors. It seems that this feature isn't documented anywhere.

Better contribution documentation

I've wanted to contribute to LESS plenty of times but while I'm a good programmer with a strong understanding of CSS, it isn't easy to digest a compiler.

I propose updated documentation that explains how to dive into different parts of the project. How to add functions, new syntax, fix bugs, etc.

The process is somewhat documented already but the page will soon be out of date as make is replaced with grunt builds. A clear set of instructions for setting up an environment, and clear entry points for common tasks are the only way contribution from anyone but the most dedicated will happen.

Further Notes On Extends

things to do, add etc. From the extend documentation

I wanted to leave the extend documentation releasable, however the following are notes that I removed which it may make sense to add later once they have been expanded upon.

Most of this is from @jonschlinkert

Examples for when "extend" will be valuable, and when it won't

The purpose of this section is to better understand how the :extend feature ought be used, thinking in terms of best practices, in order to help prioritize development decisions, and to qualify or disqualify feature requests related to this feature.

Repetitious Code

The :extend feature seems to hold the most promise as a device for:

  1. Selector Inheritance: which means you can add the styles of one selector to other selectors, but without having to manually hunt down and directly edit each of the selectors you wish to extend. Clearly, this is advantageous at the time of need, but it's also helpful with code maintenance.
    2.

:extend directive to a selector (or ruleset of a selector) allows you to add the styles of that selector to any other selectors,

.widget {
  &:extend(ul li, .blob, .kitchensink, .sanity, .willtolive, .questions, .etc);
  background: blue;
}
.widget {
  &:extend(.answers, .blob, .kitchensink, .sanity, .willtolive, .nav, .navbar, .etc);
  background: blue;
}

Don't understand:
Notice that the Extending selector was grouped before the Extended selector. This was chosen not for stylistic reasons, but to be behaviorally consistent with the expected order of inherited declarations within the block.

TODOs:
Specificity
Order of Inherited Declarations
Mixins <-- just do later?

Selectors
Type Selectors
Simple Selectors
Combinators
Pseudo-Elements

Extends with Mixins

TODO: that it is planned

.clearfix():extend() {
  // declarations
}

Extends, Mixins, "Empty" Mixins, and Placeholders

TODO
We want :extend to make our lives easier by DRYing up our stylesheets, but only when :extend cannot "pierce the context barrier" of the selector you wish to extend. So within the same context the goal is to prevent order to prevent :extend from poluting styles

new "fork me" ribbon

We'll need to replace the old ribbon with something that goes with the new theme.

getting started and general goals

  • port existing docs from lesscss.org over to use assemble
  • build system: Grunt.js, clean, jshint, assemble, assemble-less for starters
  • add site scaffold
  • start updating with new documentation that has already been created
  • sync up docs with wiki
  • remove wiki pages and put a link to the site. It will be easier to maintain everything in one place, and it will help keep traffic from the community directed to the site.
  • update theme

Update Core Less Team

@jonschlinkert @matthew-dean @cloudhead

I think we've already given @SomMeri rights on less.js? so, if you'd like, I'd like to add you to the list on the about page if you are okay with that?

@seven-phases-max you've made significant contributions to the code and docs over the last months, I'd like to add you too, if thats okay? I'd also like to give you push access, on the understanding you still create pull requests if its a large / breaking / contraversial change.

@Synchro same question to you?

I assume everyone else is okay with this?

Design goals

Just getting this started.

In broad strokes, the site will be:

  • Mobile (#8)
  • Responsive

Documentation data

One of my "design" goals for the new site is to look for opportunities to make data more reusable, whenever possible. For example, our CHANGELOG will be formatted as YAML so that it can be parsed and used in templates. This allows the changelog to be rendered as markdown, HTML, or even pulled down from the GitHub API and consumed by some other application or lib.

I also believe that - if executed well - this will make the site more accessible, scalable and maintainable.

  • changelog: version (object|key), date (string), changes (associative array)
  • language features (todo)

Related

  • Docs API: #3

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.