Styleguide for the geocity_front app | Read-only mirror of https://github.com/yverdon/geocity_styleguide — Ville d'Yverdon-les-Bains. Issues & pull requests at the source.
  • SCSS 41.8%
  • JavaScript 37.9%
  • CSS 20.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
Benoît Burgener 7996951da5 Release 0.7.0
2023-03-09 15:15:18 +01:00
assets feat: update Node and dependencies 2023-03-09 14:56:07 +01:00
components Refactor disabled style for button & form fiels 2020-11-18 15:01:57 +01:00
docs add icons 2022-05-23 15:00:00 +02:00
public Release 0.7.0 2023-03-09 15:15:18 +01:00
theme feat: update Node and dependencies 2023-03-09 14:56:07 +01:00
.browserslistrc Setup fractal with Tailwind 2020-08-25 12:57:10 +02:00
.editorconfig Setup fractal with Tailwind 2020-08-25 12:57:10 +02:00
.eslintrc.json core: update node dep. 2022-01-17 16:48:29 +01:00
.gitignore Setup fractal with Tailwind 2020-08-25 12:57:10 +02:00
.nvmrc feat: update Node and dependencies 2023-03-09 14:56:07 +01:00
.release-it.json chore: build before releasing 2023-03-09 15:14:56 +01:00
babel.config.js Setup fractal with Tailwind 2020-08-25 12:57:10 +02:00
CHANGELOG.md Release 0.7.0 2023-03-09 15:15:18 +01:00
fractal.config.js core: update node dep. 2022-01-17 16:48:29 +01:00
LICENSE Create LICENSE 2021-07-06 14:28:16 +02:00
package-lock.json Release 0.7.0 2023-03-09 15:15:18 +01:00
package.json Release 0.7.0 2023-03-09 15:15:18 +01:00
postcss.config.js feat: update Node and dependencies 2023-03-09 14:56:07 +01:00
prettier.config.js Setup fractal with Tailwind 2020-08-25 12:57:10 +02:00
README.md feat: update Node and dependencies 2023-03-09 14:56:07 +01:00
server.js core: update node dep. 2022-01-17 16:48:29 +01:00
stylelint.config.js Setup fractal with Tailwind 2020-08-25 12:57:10 +02:00
tailwind.config.js core: update node dep. 2022-01-17 16:48:29 +01:00
webpack.config.js fix: webpack config font files generation 2022-04-04 13:16:25 +02:00

Geocity Styleguide

Styleguides build with Fractal and Webpack.

  • Fractal pre-configured with Nunjucks
  • JavaScript bundling with Webpack and Babel
  • Sass compilation, including Autoprefixer
  • SVG icons sprite generation
  • Live reload (with hot module replacement) for comfortable development
  • Automated release management with release-it

Node and npm version

If you have nvm installed on your system, you can simply nvm use in the root directory to pick up the correct version provided in the .nvmrc file.

Installation

Prerequisites: Node.js, for the current version see in /.nvmrc.

Install the npm dependencies with:

npm install

Getting started

To start the development server, run:

npm start

You can now access your styleguide at localhost:3000.

Youre all set, start to:

  • Create components as .nunj (Nunjucks) files inside the components directory
  • Write some style inside assets/scss/common.scss
  • Write JavaScript inside assets/scripts/common.js
  • Put some *.svg icons in the assets/icons directory
  • Write documentation as .md (Markdown) files inside the docs directory.

Build

You can build a static version of the styleguide to deploy it wherever you like by running:

npm run build

The generated files go to the dist directory.

Release

The starterkit comes with a preconfigured release management tool. It will automatically update the CHANGELOG.md file at the root of the project based on the commit messages as long as they follow the Angular commit guidelines. It will also bump the version number in the package.json, run the build command above, commit, tag and push the changes. This process is interactive and youll be able to skip steps manually if you like.

To release a new version run:

npm run release [patch|minor|major|version_number]

By default the version bump is automatically determined based on the commits messages.

Read more in the release-it documentation.

Deploy

To deploy a build of the styleguide, simply replace the blank command in the package.json, under scripts -> deploy. This will be automatically invoked at the end of the release process described above.

An example of a simple deploy command using rsync:

"deploy": "rsync -avz --delete --exclude='.*' dist/ user@server.com:/var/www/html/my-styleguide"

⚠️ Notice the --delete flag which means all files not present locally will be deleted on the remote server. Be careful, this can leads to data loss!

You can also deploy manually at any time by running:

npm run deploy

Misc

Browsers support

The browsers support is defined in .browserslistrc. Its used both by Autoprefixer for the CSS and by @babel/preset-env for the JavaScript.

Check browserslists documentation to change the browser support.

Icons

Icons placed inside assets/icons are combined into a sprite called icons.svg when referenced. To load them, either reference them in your JavaScript:

import 'icons/foo.svg';

Or in your stylesheet:

background-image: url('../icons/foo.svg');

Webpack will automatically rewrite the links to the sprite with the correct identifier. See svg-sprite-loader documentation for more information.

You can then easily use an icon in a template with the icon snippet:

{% render '@icon', { id: 'foo', class: 'bar' } %}

Warning: This method of including remote SVG file is not supported by Internet Explorer 11 and below. You may want to polyfill it with svgxuse.