What's set up here:
- Sass (LibSass)
- Autoprefixer
- CSS Minification
- JSHint
- Scss Lint (based on this config)
- HTML Minification
- BrowserSync
- Image Minification
- GH-Pages deployment from dist/ folder
- Install node and make sure npm (Node Project Manager) is also installed
- Clone this repo with
git clone https://github.com/una/gulp-starter-env
(in terminal) or download the zip - In terminal,
cd
(change directory) to the folder containing your project. (i.e. if I start at ~ and I have a Dev folder on my Desktop containing this project, I might typecd Desktop/Dev/gulp-starter-env
). Alternatively, you can typecd
and drag the location of the folder into your terminal and hit enter. - When inside the directory which contains this project in terminal, type
npm install
. If (and only if) you're having trouble withnpm install
, trysudo npm install
-- this makes you act as a super user - In the terminal, enter
gulp
- Take note of the Access URLs provided in your terminal. Your web page should pop up at
http://localhost:3000
. You can access this same page on your various devices in the same wifi network with the provided External URL. You can share the External URL with coworkers and they'll see whats on your screen. - Edit your Sass code inside of the scss folder. You can make subfolders inside of that to better organize your code. Prefix your sass files with an underscore. More info on using @import to organize your files here
- Your minified files will be automagically created and updated in
dist/
. It will create your optimized css, html, and javascript files for you. Never edit files within thedist/
folder. (Dist stands for Distribution) - Keep gulp running while you're making changes. When you want to close out of the gulp task, in the terminal, hit
ctrl + C
This linter is the only ruby
dependency in this project. It is also optional!
File Linting is where you read your file to make sure that your code conforms to standards. You should be doing this continuously.
If you're using a text editor like Sublime, I'd recommend installing SublimeLinter
and SublimeLinter-contrib-scss-lint
. You can also lint with gulp inside of your terminal by running gulp scss-lint
.
You can run npm deploy
to push your site onto the gh-pages branch. Then, you can navigate to it via http://< your-github-username >.github.io/< project-name >
cd
: change directory (a terminal command). Make sure you have a space betweencd
and the location you are navigating torepo
: repository (this is a 'repository' of code)sudo
: you get access as a 'super user' of your system (you can override permissions)npm
: node project manager -- the command line task manager that is installing everything inside ofpackage.json
package.json
: a file with information about your project. This is also where your list of dependencies lives which npm installsgulp
: a task manager that is running a bunch of scripts to make this environment workdist
: distribution folder -- don't edit anything in here. It is where your gulp task builds intoscss
: a Sass syntax that imitates CSS