GithubHelp home page GithubHelp logo

frontend-oddk's Introduction

Open Data DK theme

To watch files:

npx gulp

This watches for changes to CSS and icons. On changes to CSS PostCSS and plugins (postcss-import, postcss-preset-env, tailwindcss, cssnano) are run. On icon changes, the SVG icon sprite is remade. These processes can be run without watching via npx gulp css and npx gulp icons.

Note: Unless you are making significant changes to the design, you probably won't need these processes. Most styling is done through Tailwind's utility classes.

Tailwind CSS

The CSS framework Tailwind is used to style this theme. This means that if you want to change the appearance of something, or add new elements, Tailwind utility classes should provide you with what you need. The docs at tailwindcss.com should provide you with most of what you need to know.

Exceptions

Some styles have been extracted out into CSS files (src/css/components). The spirit of Tailwind would be to avoid doing this, but there are two scenarios where it becomes desirable, or necessary.

  1. You are repeating a combination of utility classes.
  2. You need aspects of CSS that is not catered for by Tailwind.

Scenario 1 should probably be resolved with the use of (Nunjucks) templates where reasonable to do so. This codebase could probably be improved a little in that regard.

In either scenario, the @apply feature is and should be used, whenever dealing with the variable-like utility classes, such as width, padding, colour etc. This ensures that the same variables are being used throughout, and that a change to the Tailwind configuration will effect these custom components.

In addition to the components directory, there is an elements.css file, which adds some styles to base HTML tags, mostly when nested in specific containers. For example, headings and paragraphs within a content wrapper get styling, without the need to add classes to each element.

(This convention of components and elements is not Tailwind related, but part of a general approach to making stuff easy to find.)

Structure

All Tailwind classes and custom components are imported into src/app.css. The importing, and other operations (such as Tailwind) are handled by PostCSS plugins, as defined in gulpfile.js.

Tailwind is configured in tailwind.config.js. The configuration for this theme adds an additional spacing variable named gutter, to remove some of the guess work from spacing e.g "Was I using p-4 or p-6 to separate columns?". The default colour and font family have been replaced. Note, unlike the addition of the gutter value, colour and font family were replaced, so the values found in the Tailwind docs will not be applicable.

Icons

Icons are used like so: <svg><use xlink:href="#<filename>" /></svg>. Eg. to use the src/icons/search.svg icon, you put the following in the template: <svg><use xlink:href="#search" /></svg>.

frontend-oddk's People

Contributors

anuveyatsu avatar

Watchers

James Cloos avatar

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.