Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here is how to install tailwind version 4 with a flask app that has blueprints.
- The tailwind.config,js might vary if you are not using blueprints in flask.
- Here are the instructions in flask
- https://tailwindcss.com/docs/installation/tailwind-cli
- First I run > npm init -y
- package.json
- {
- "name":"someapp",
- "version":"1.0.0",
- "description":"1. Clone the project",
- "main":"index.js",
- "scripts": {
- "tailwind-build":"npx tailwindcss -i ./app/static/src/input.css -o ./app/static/output.css --watch --config C:/Users/user/OneDrive/Desktop/someapp/tailwind.config.js"
- },
- "keywords": \[\],
- "author":"",
- "license":"ISC",
- "dependencies": {
- "@tailwindcss/cli":"\^4.0.13",
- "tailwindcss":"\^4.0.13"
- }
- }
- Next
- > \npm install tailwindcssu/tailwindcss/cli``
- Then I manually create input.css in the src folder
- static/src/input.css
- Here are the contents of *input.css*
- "tailwindcss";
- Then I manually create tailwind.config,js in someapp folder
- Here are the contents of *tailwind.config,js*
- /** {import('tailwindcss').Config} */
- export default {
- content: ["./app/templates/**/*.html", "./app/static/src/**/*.css"],
- theme: {
- extend: {},
- },
- plugins: [],
- };
- Then if you are using vscode type in the terminal > run npm run tailwind-build and then on a second terminal I open go flask run/ run the flask code. ALso make sure both terminals are open at the same time and both running.
- I have no idea how this works in production though.
- I based the flask app on a similar structure to this https://github.com/miguelgrinberg/microblog
- Also make sure you point to the static folder or whatever the name is.
- app = Flask(__name__, static_folder='static')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement