in your own forked repo
- setup gulp to watches and compiles sass files to the public css directory
- use sass to style
index.html
so that it matches the layouts in thelayouts
directory
you may accomplish these goals without following the steps outlined below
- fork and clone this repo
If you have not have npm and gulp, you need to install them.
brew install npm
npm install -g gulp
- initialize your forked project with npm libs,
npm init
- setup your
.gitignore
file to ignorenode_modules
- add and commit your 2 new files to be tracked in git
- install and save required dependencies using
npm install -D [node_module name]
gulp
gulp-sass
- setup sass source directory
mkdir sass/
- setup sass source file
touch sass/styles.scss
- setup sass compiled output directory
mkdir public/css
- setup Gulpfile
touch gulpfile.js
- setup Gulpfile task, with
watch_sass
anddefault
tasks subl gulpfile.js
- contents of gulpfile.js
- test gulp task
- 'hello world' of sass,
subl sass/styles.scss
```` $dark-color : #333333;
body {
background: $dark-color;
}
````
- run
gulp
in your terminal - check output,
ls public/css
(should say styles.css) - inspect output,
cat public/css/styles.css
( should be proper css ) - once gulp and sass are wired up correctly, commit your new files
- make sure to keep your "gulp" terminal running and visible, if your sass source is invalid, it will crash the watching gulp process, and you will want to see the error message that will output in that terminal. Then you can restart your
gulp
watcher after fixing your errors.
- (on a seperate terminal, since gulp is being held open), navigate to your
public/
subdirectory, then run anhttp-server
- open a browser to make sure you can see
public/index.html
rendered - setup your
public/index.html
to link to yourpublic/css/styles.css
stylesheet. - If it works, your background shold be gray. commit your work.
- Create a
partials
directory inside thesass
directory and add areset.scss
file that contains aclearfix
style and acss reset
. Import the reset file into yourstyles.scss
file at the top of the document. - Import the
Droid Serif
Google font into yourstyles.scss
file at the top of the document, after importing the reset file. The format of the import should look like this:
@import "http://fonts.googleapis.com/css?family=Droid+Serif:400,700.css";
- Editing only your
sass/styles.scss
file, style your html page so that it matches the layout in thelayouts
directory.