Pokémon Central Wiki CSS styles, refactored in SCSS language.
This started as a refactoring of the original Common.css: it was getting huge and messy; moreover, writing plain old CSS is a pain. In addition to that, flexbox styles from a specific extension have been merged here.
- Install Node.js environment for your operating system.
- Open a root/administrator shell and launch
npm install gulpjs/gulp-cli -g
- Move in the project main directory and happily download all the dependencies
with
npm install
.
The build process is powered by gulp v4. It consists of four main steps:
- Downloading some SVG icons.
- Inlining such SVG icons.
- Compiling SCSS to CSS.
- Adding vendor prefixes.
However, the actual tasks don't match these steps. In fact, it would not be worth the effort to split the build process in this way, since the steps are hardly ever executed individually.
There are two main tasks in the gulpfile.js
, plus a watch
and default
tasks that are mere aliases. These are:
-
icons
: This task downloads the SVG icons straight from Pokémon Central website, minifies them (even though I'm pretty sure this doesn't really reduce the size significantly), and finally inlines them in the SCSS. The output of the whole process is a couple of SCSS files in the_icons
directory: the reason for this seemingly weird outcome is the use of gulp-sass-inline-svg plugin. It was chosen to split this task from the maincompile
one, as it operates on different inputs and produces other outputs: moreover, SCSS files should have been added later to the pipeline, as the plugin only handles SVG inputs. -
compile
: This task carries out the main job: it produces the CSS files that can be loaded on Pokémon Central Wiki. This implies: executing theicons
task; compiling SCSS files to CSS (including the output oficons
); adding vendor prefixes. For more information on the SCSS compilation, read the **** section. -
watch
: Watcher forcompile
: it executescompile
whenever its inputs change. -
default
: alias forwatch
.
However, the inclusion of files is SCSS based, and the import scheme is based
on an _all.scss
file located in each sub-directory, that in turn imports all
the files in the directory. This was chosen in order to minimize git conflicts.