Skip to content

Commit

Permalink
organize src and config
Browse files Browse the repository at this point in the history
  • Loading branch information
fsubal committed Oct 15, 2023
1 parent 73082fe commit e2f2dd0
Show file tree
Hide file tree
Showing 15 changed files with 58 additions and 35 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "0.0.0",
"description": "",
"scripts": {
"build:cli": "tailwindcss build --input src/main.css --output dist/main.css",
"build:cli": "tailwindcss build --config src/第3章_Tailwind_CSSを導入する/tailwind.config.js --input src/第3章_Tailwind_CSSを導入する/src/main.css --output dist/main.css",
"build:webpack": "webpack build --config src/第3章_Tailwind_CSSを導入する/webpack.config.js --progress",
"build:gulp": "gulp tailwindcss:build --gulpfile src/第3章_Tailwind_CSSを導入する/gulpfile.js",
"test:jest": "jest src/第7章_Tailwind_CSSをカスタマイズする/7_3_JavaScript_APIを利用する/jest/preset.test.js --config src/第7章_Tailwind_CSSをカスタマイズする/7_3_JavaScript_APIを利用する/jest/jest.config.js",
Expand Down
4 changes: 2 additions & 2 deletions src/第3章_Tailwind_CSSを導入する/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const autoprefixer = require("autoprefixer");

gulp.task("tailwindcss:build", () =>
gulp
.src("../main.css")
.pipe(postcss([tailwindcss, autoprefixer]))
.src("src/main.css")
.pipe(postcss([tailwindcss("./tailwind.config.js"), autoprefixer]))
.pipe(gulp.dest("../../dist")),
);
12 changes: 12 additions & 0 deletions src/第3章_Tailwind_CSSを導入する/src/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Tailwind CSS</title>
<link rel="stylesheet" href="./main.css" />
</head>
<body>
<div class="text-white"></div>
</body>
</html>
File renamed without changes.
11 changes: 11 additions & 0 deletions src/第3章_Tailwind_CSSを導入する/tailwind.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: {
relative: true,
files: ["src/index.html"],
},
theme: {
extend: {},
},
plugins: [],
};
7 changes: 5 additions & 2 deletions src/第3章_Tailwind_CSSを導入する/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
mode: "development",
entry: {
tailwindcss: path.resolve(__dirname, "..", "main.css"),
tailwindcss: path.resolve(__dirname, "src", "main.css"),
},
output: {
path: path.resolve(__dirname, "..", "..", "dist"),
Expand All @@ -20,7 +20,10 @@ module.exports = {
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [require("tailwindcss"), require("autoprefixer")],
plugins: [
require("tailwindcss")(require("./tailwind.config.js")),
require("autoprefixer"),
],
},
},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/** @type {import('tailwindcss').Config} */
module.exports = {
content: [],
content: ["../../index.html"],
theme: {
extend: {},
},
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import "tailwindcss";
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// @ts-check
const { trimmedTextPlugin } = require("./plugins/trimmedTextPlugin");

const {
defineVarNameInGlobalCss,
generateVarNames,
} = require("./plugins/cssVariablePlugin");

const { langPlugin } = require("./plugins/langPlugin");

const myColorTheme = require("./theme/myColorTheme");

/** @type {import('tailwindcss').Config} */
module.exports = {
content: ["src/index.html"],
theme: {
colors: generateVarNames(myColorTheme.light),
extend: {},
},
plugins: [
trimmedTextPlugin,
defineVarNameInGlobalCss(myColorTheme),
langPlugin,
],
};
29 changes: 0 additions & 29 deletions tailwind.config.js

This file was deleted.

0 comments on commit e2f2dd0

Please sign in to comment.