How to use TravisCI to compile my SASS for GitHub Pages branch?

Viewed 173

I have a repository with sass files and I want to deploy this repo to gh-pages. But gh-pages does not recognize sass. So I am using TravisCI to compile my master branch's sass and deploy to gh-pages branch. However, because my master branch contains:

.gitignore

node_modules
css/*
!css/.gitkeep

so that I do not commit any locally compiled css files, only the sass files.

This is appears to be causing my gh-pages branch to also ignore the css files. I can see in the TravisCI build logs that the css file is being created. But when I go to view gh-pages, obviously there is no css.

My travis config:

language: node_js
node_js:
  - "11.6.0"
cache: npm

install:
  - npm ci

script:
  - npm run compile

deploy:
  provider: pages
  skip-cleanup: true
  github-token: $GITHUB_TOKEN
  on:
    branch: master

package.json:

"scripts": {
    "sass": "node-sass sass/main.scss css/style.css -w",
    "compile": "node-sass sass/main.scss css/style.css"
  }
0 Answers
Related