GeezerVisonThe World Wide Web, restored to 800 pixels of glory. |
| Home|About|Gaming cabinet|Archives|How it works|Starter sites |
GeezerVison is showing github.com — Coding Guide Coding Guide
Esmé Cowles edited this page
Golden rule: make your code look similar to what's around it. This project touches on a lot (YAML data, SASS/CSS, JavaScript, HTML & Liquid templates, Markdown posts, etc) so it's hard to elaborate every single formatting nuance but we can always mimic what already exists. When editing template files, pay attention to the header hierarchy. Every page should have a single You should view all rendered pages that include the template to ensure they have a property hierarchy; you cannot necessarily assume that the fragment you're working on starts at a particular level. For instance, the HTML files under general-info/venues/ all start at In some instances, fragments are used in multiple locations where the hierarchy outside them differs, e.g. _includes/homepage/pre_conference.html is included both on the home page after an If you're unfamiliar with Jekyll and its use of Liquid templates, you can read the Liquid documentation and the list of filters and tags that Jekyll provides. When possible, use a When using data, never assume that it will be filled out. At the start of the year, many variables and even data files are erased and items are unknown initially. Try to wrap sections in Prefer Liquid Indent four spaces whenever entering a new block-level (header, section, div, p) tag or a Liquid statement such as a loop or Images have alt text. Form inputs have labels. Be accessible! We run accessibility tools over our pages to catch errors. Use Bootstrap classes frequently. Top, block-level elements of your HTML likely need some kind of Bootstrap layout class (e.g. We use SASS, an extension of CSS which is compiled down to CSS during the site's build process. While you're developing, if you run Styles go in assets/_scss/ where they are be divided up by function (buttons, clip circles), segment of page (header, footer), or specific content type (testimonials, sponsors). These smaller files are then included one by one in assets/css/main.css which contains no actual styles, only SASS Indent two spaces. You should indent CSS properties within a selector rule, then SASS nested selectors are further indented within that. Use variables for all colors and other values that may be repeated. Variables live in assets/_scss/_variables.scss. Avoid ID selectors because of their specificity causes problems. In general, all CSS good advice applies. SASS is your friend! Use nested selectors, mixins, functions, variables to your heart's content. Most of these are powerful tools for organizing code and managing complexity/consistency. Don't write new styles if you can use Bootstrap! We have Bootstrap 3 on the site and it provides numerous useful classes for layout and basic styling. Code4Lib takes accessibility very seriously; there are usually multiple talks on the topic at the conference. We really want the website to live up to our community's standards. There have already been some tips in other sections but here are several general rules to keep in mind:
There are many accessibility audit tools that aid us in identifying potential issues. The Chrome Developer Tools and WAVE are two popular, powerful ones. These will not catch every issue but are pretty great at noticing certain things, such as when the above rules are violated, color contrasts are insufficient, and header hierarchies aren't followed. Screenshot of us passing the Chrome dev tools accessibility audit. JS goes in /assets/js/ where there is one monolithic main.js included on every page and smaller files for specific functionality (search) or content that needs extra code (e.g. the donation thermometer). We have jQuery available on the site. If you want to use it, it's typically good advice to put everything inside a handler that ensures the definition of the jQuery(document).ready(function($){ // do stuff here... }); We use JavaScript pretty sparingly and should try to keep it that way, or else develop better workflows around code management like we have for SASS. Lumping all our various code into one un-minified main.js is not sustainable. As with SASS, follow common JS best practices. JSHint or similar (ESlint) is your friend. Don't make global variables. Indent four spaces. Indent whenever entering a new block of code: if condition, loop, function, etc. Modern ES6 JavaScript ( You can use Jekyll site variables (e.g.
Clone this wiki locally |
| You are visitor 01402503 — GeezerVison does not store the pages you look up. Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required. |