This contains a base example of how to build an object using sass and utilise the object key value loop in order to create multiple colour variations of the same component, page or website, where the hex value is the variable that changes.
It has been built to work with a data-theme
data attribute so that it doesn't get confused with any other classes and makes it more readable.
- Gulp
watch
setup for reading and compiling the SASS directory.- Using
gulp-sass
for the compiling - Included
gulp-sourcemaps
to embed inline sourcemaps within the compiledmain.css
file
- Using
- Reset stylesheet by Meyer Web (with a few tweaks).
- A Read more component which is being used to illustrate the colour theme setup.
- Install NodeJS on your machine (Globally)
- Clone this repo (or download directly).
- Open the command line of your choice and cd to the root directory of this repo on your machine.
- Install Gulp globally by running
npm install -g gulp
in your terminal window - Now that you have NodeJS installed, you can run
npm install
in the root director. This will read the `package.json file and install all required dependencies in a node_modules folder. - To initiate the SASS gulp function, entering
gulp watch
in the project root will fire it up in your terminal window.
NOTE: Gulp.watch is used typically for small projects, and so the watch function doesn't recognise when SASS files are added or deleted. The terminal process running the gulp task has to be restarted to pick up any new SASS files.
Because this is a flat HTML page, you can open the index.html
file directly from the root without having to fire up a local dev environment.