Skip to content
This repository has been archived by the owner on Jun 13, 2023. It is now read-only.

Commit

Permalink
Setup sass loader.
Browse files Browse the repository at this point in the history
- Bump from alpine 3.10 to 3.11 to avoid compiling node-sass. It's important to avoid this as it decreased the build time to ~2 mintues :/.  See sass/node-sass#2822 (comment)
- CI: cache node modules using the github action cache.
  • Loading branch information
rdok committed Jan 22, 2020
1 parent 968bc83 commit 361a682
Show file tree
Hide file tree
Showing 9 changed files with 1,050 additions and 40 deletions.
17 changes: 13 additions & 4 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,15 @@ jobs:

steps:
- uses: actions/checkout@v1
- name: Cache node modules
uses: actions/cache@v1
with:
path: cache_node
key: ${{ runner.os }}-node-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-node-${{ env.cache-name }}-
${{ runner.os }}-node-
${{ runner.os }}-
- name: Set env
run: |
echo ::set-env name=ID::$(id -u)
Expand All @@ -25,7 +34,7 @@ jobs:
run: |
docker-compose run --rm node yarn
docker-compose run --rm node yarn run build
- name: Sync with S3
run: aws s3 sync ./public s3://training-apps-rdok/indecision --delete
- name: Create CloudFront invalidation
run: aws cloudfront create-invalidation --distribution-id "${AWS_CLOUDFRONT_DISTRIBUTION_ID}" --paths /indecision/index.html /indecision/bundle.js
# - name: Sync with S3
# run: aws s3 sync ./public s3://training-apps-rdok/indecision --delete
# - name: Create CloudFront invalidation
# run: aws cloudfront create-invalidation --distribution-id "${AWS_CLOUDFRONT_DISTRIBUTION_ID}" --paths /indecision/index.html /indecision/bundle.js
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_cache/
public/
!public/index.html

Expand Down
6 changes: 4 additions & 2 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ services:

dev-server:
restart: always
image: node:13-alpine3.10
image: node:13-alpine3.11
command: yarn run dev-server
user: "${UID}:${GID}"
working_dir: /app
Expand All @@ -15,9 +15,11 @@ services:

node:
restart: always
image: node:13-alpine3.10
image: node:13-alpine3.11
command: tail -f /dev/null
user: "${UID}:${GID}"
working_dir: /app
environment:
- YARN_CACHE_FOLDER=/app/node_cache/yarn
volumes:
- .:/app
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
"@babel/preset-env": "^7.8.3",
"@babel/preset-react": "^7.8.3",
"babel-loader": "^8.0.6",
"css-loader": "^3.4.2",
"live-server": "^1.2.1",
"node-sass": "^4.13.1",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-modal": "^3.11.1",
"sass-loader": "^8.0.2",
"style-loader": "^1.1.3",
"validator": "^12.1.0",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10",
Expand Down
1 change: 1 addition & 0 deletions public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
<head>
<meta charset="UTF-8"/>
<title>Indecision</title>
<link rel="shortcut icon" href="./favicon.ico" />
</head>
<body>

Expand Down
1 change: 1 addition & 0 deletions src/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from 'react';
import ReactDOM from 'react-dom'
import './styles/styles.sass'

import {App} from './app'

Expand Down
4 changes: 4 additions & 0 deletions src/styles/styles.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
$brand-color: blue

*
color: $brand-color
17 changes: 12 additions & 5 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,18 @@ module.exports = {
},
mode: 'development',
module: {
rules: [{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
}]
rules: [
{
loader: 'babel-loader',
test: /\.js$/,
exclude: /node_modules/
},
{
use: ['style-loader', 'css-loader', 'sass-loader'],
test: /\.sass$/,
exclude: /node_modules/
}
]
},
devtool: 'cheap-module-eval-source-map',
devServer: {
Expand Down
Loading

0 comments on commit 361a682

Please sign in to comment.