Advertisement
Guest User

Untitled

a guest
Mar 12th, 2025
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1.  
  2. Here is how to install tailwind version 4 with a flask app that has blueprints.
  3.  
  4. The tailwind.config,js might vary if you are not using blueprints in flask.
  5.  
  6. Here are the instructions in flask
  7.  
  8. https://tailwindcss.com/docs/installation/tailwind-cli
  9.  
  10. First I run > npm init -y
  11.  
  12. package.json
  13.  
  14. {
  15.  
  16. "name":"someapp",
  17.  
  18. "version":"1.0.0",
  19.  
  20. "description":"1. Clone the project",
  21.  
  22. "main":"index.js",
  23.  
  24. "scripts": {
  25.  
  26. "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"
  27.  
  28. },
  29.  
  30. "keywords": \[\],
  31.  
  32. "author":"",
  33.  
  34. "license":"ISC",
  35.  
  36. "dependencies": {
  37.  
  38. "@tailwindcss/cli":"\^4.0.13",
  39.  
  40. "tailwindcss":"\^4.0.13"
  41.  
  42. }
  43.  
  44. }
  45.  
  46. Next
  47.  
  48. > \npm install tailwindcssu/tailwindcss/cli``
  49.  
  50. Then I manually create input.css in the src folder
  51.  
  52. static/src/input.css
  53.  
  54. Here are the contents of *input.css*
  55.  
  56. "tailwindcss";
  57.  
  58. Then I manually create tailwind.config,js in someapp folder
  59.  
  60. Here are the contents of *tailwind.config,js*
  61.  
  62. /** {import('tailwindcss').Config} */
  63. export default {
  64. content: ["./app/templates/**/*.html", "./app/static/src/**/*.css"],
  65. theme: {
  66. extend: {},
  67. },
  68. plugins: [],
  69. };
  70.  
  71. 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.
  72.  
  73. I have no idea how this works in production though.
  74.  
  75. I based the flask app on a similar structure to this https://github.com/miguelgrinberg/microblog
  76.  
  77. Also make sure you point to the static folder or whatever the name is.
  78.  
  79. app = Flask(__name__, static_folder='static')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement