diff --git a/.gitignore b/.gitignore
index 5aea041..3a37add 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,3 +4,4 @@
yarn-error.log
/cypress/screenshots/
/__sapper__/
+.idea
diff --git a/now.json b/now.json
new file mode 100644
index 0000000..cbe61e9
--- /dev/null
+++ b/now.json
@@ -0,0 +1,33 @@
+{
+ "name": "template",
+ "version": 2,
+ "builds": [
+ {
+ "src": "__sapper__/build/index.js",
+ "use": "@now/node-server",
+ "config": {
+ "includeFiles": [
+ "build.json",
+ "../../package.json",
+ "../build/**",
+ "../../static/**",
+ "../../node_modules/**"
+ ],
+ "maxLambdaSize": "15mb"
+ }
+ },
+ {
+ "src": "static/**",
+ "use": "@now/static"
+ },
+ {
+ "src": "__sapper__/build/client/**",
+ "use": "@now/static"
+ }
+ ],
+ "routes": [
+ { "src": "/(.*(\\.css)|(\\.json)|(\\.png))", "dest": "/static/$1" },
+ { "src": "/client/(.*)", "dest": "/__sapper__/build/client/$1" },
+ { "src": "/(.*)", "dest": "/__sapper__/build/index.js" }
+ ]
+}
\ No newline at end of file
diff --git a/package.json b/package.json
index d9403c2..a5238d5 100644
--- a/package.json
+++ b/package.json
@@ -9,18 +9,24 @@
"start": "node __sapper__/build",
"cy:run": "cypress run",
"cy:open": "cypress open",
- "test": "run-p --race dev cy:run"
+ "test": "run-p --race dev cy:run",
+ "now": "npm run build:tailwind && SAPPER_TIMESTAMP=$(date +%s%3N) sapper build && now -e SAPPER_TIMESTAMP=$(date +%s%3N)",
+ "watch:tailwind": "postcss static/tailwind.css -o static/index.css -w",
+ "build:tailwind": "NODE_ENV=production postcss static/tailwind.css -o static/index.css"
},
"dependencies": {
"compression": "^1.7.1",
"polka": "^0.5.0",
- "sirv": "^0.4.0"
+ "sirv": "^0.4.0",
+ "tailwindcss": "^1.0.4",
+ "@fullhuman/postcss-purgecss": "^1.2.0"
},
"devDependencies": {
"npm-run-all": "^4.1.5",
"sapper": "^0.27.0",
"svelte": "^3.0.0",
"svelte-loader": "^2.9.0",
- "webpack": "^4.7.0"
+ "webpack": "^4.7.0",
+ "postcss-cli": "^6.1.2"
}
}
diff --git a/postcss.config.js b/postcss.config.js
new file mode 100644
index 0000000..c0c0a9b
--- /dev/null
+++ b/postcss.config.js
@@ -0,0 +1,16 @@
+const tailwindcss = require("tailwindcss");
+
+// only needed if you want to purge
+const purgecss = require("@fullhuman/postcss-purgecss")({
+ content: ["./src/**/*.svelte", "./src/**/*.html"],
+ defaultExtractor: content => content.match(/[A-Za-z0-9-_:/]+/g) || []
+});
+
+module.exports = {
+ plugins: [
+ tailwindcss("./tailwind.config.js"),
+
+ // only needed if you want to purge
+ ...(process.env.NODE_ENV === "production" ? [purgecss] : [])
+ ]
+}
diff --git a/src/template.html b/src/template.html
index bfeebc9..cbd5bdb 100644
--- a/src/template.html
+++ b/src/template.html
@@ -7,6 +7,7 @@
%sapper.base%
+
diff --git a/static/tailwind.css b/static/tailwind.css
new file mode 100644
index 0000000..bd6213e
--- /dev/null
+++ b/static/tailwind.css
@@ -0,0 +1,3 @@
+@tailwind base;
+@tailwind components;
+@tailwind utilities;
\ No newline at end of file
diff --git a/tailwind.config.js b/tailwind.config.js
new file mode 100644
index 0000000..c9e361e
--- /dev/null
+++ b/tailwind.config.js
@@ -0,0 +1,7 @@
+module.exports = {
+ theme: {
+ extend: {}
+ },
+ variants: {},
+ plugins: []
+}
\ No newline at end of file