@@ -79,8 +79,9 @@ setup_tailwindcss_plugin(
7979 mode = " offline" ,
8080 tailwind_version = " 3" , # Specify Tailwind CSS version (v3 or v4)
8181 content_path = [" **/*.py" ], # Files to scan for Tailwind classes
82- output_css_path = " .tailwind/tailwind.css" , # Output CSS file
83- config_js_path = " .tailwind/tailwind.config.js" , # Tailwind config file
82+ plugin_tmp_dir = " _tailwind" , # Temporary directory for plugin files
83+ output_css_path = " _tailwind/tailwind.css" , # Output CSS file
84+ config_js_path = " _tailwind/tailwind.config.js" , # Tailwind config file
8485 download_node = True , # Download Node.js if not found
8586 node_version = " 18.17.0" # Specify Node.js version to download
8687)
@@ -95,6 +96,58 @@ if __name__ == "__main__":
9596 app.run(debug = True )
9697```
9798
99+ ### Custom Plugin Temporary Directory
100+
101+ You can specify a custom temporary directory for plugin files:
102+
103+ ``` python
104+ from dash import Dash, html
105+ from dash_tailwindcss_plugin import setup_tailwindcss_plugin
106+
107+ # Initialize with custom plugin temporary directory
108+ setup_tailwindcss_plugin(
109+ mode = " offline" ,
110+ plugin_tmp_dir = " _my_tailwind" , # Custom temporary directory
111+ input_css_path = " _my_tailwind/input.css" ,
112+ output_css_path = " _my_tailwind/output.css" ,
113+ config_js_path = " _my_tailwind/config.js"
114+ )
115+
116+ app = Dash(__name__ )
117+ app.layout = html.Div([
118+ html.H1(" Custom Directory" , className = " text-3xl font-bold text-green-600" ),
119+ html.P(" This uses a custom temporary directory." , className = " text-gray-700 mt-4" )
120+ ])
121+
122+ if __name__ == " __main__" :
123+ app.run(debug = True )
124+ ```
125+
126+ ### Control Build Skip Behavior
127+
128+ You can control whether to skip rebuilding if CSS was recently generated:
129+
130+ ``` python
131+ from dash import Dash, html
132+ from dash_tailwindcss_plugin import setup_tailwindcss_plugin
133+
134+ # Initialize with custom skip build parameters
135+ setup_tailwindcss_plugin(
136+ mode = " offline" ,
137+ skip_build_if_recent = True , # Skip build if CSS was recently generated
138+ skip_build_time_threshold = 10 # Consider CSS recent if generated within 10 seconds
139+ )
140+
141+ app = Dash(__name__ )
142+ app.layout = html.Div([
143+ html.H1(" Smart Rebuild" , className = " text-3xl font-bold text-purple-600" ),
144+ html.P(" This uses smart rebuild behavior." , className = " text-gray-700 mt-4" )
145+ ])
146+
147+ if __name__ == " __main__" :
148+ app.run(debug = True )
149+ ```
150+
98151### Custom Theme Configuration
99152
100153You can extend Tailwind's default theme by providing a custom theme configuration:
@@ -234,9 +287,10 @@ The plugin accepts the following parameters:
234287- ` mode ` : "online" or "offline" (default: "offline")
235288- ` tailwind_version ` : "3" or "4" (default: "3")
236289- ` content_path ` : Glob patterns for files to scan (default: [ "** /* .py"] )
237- - ` input_css_path ` : Path to input CSS file (default: ".tailwind/tailwind_input.css")
238- - ` output_css_path ` : Path to output CSS file (default: ".tailwind/tailwind.css")
239- - ` config_js_path ` : Path to Tailwind config file (default: ".tailwind/tailwind.config.js")
290+ - ` plugin_tmp_dir ` : Temporary directory for plugin files (default: "_ tailwind")
291+ - ` input_css_path ` : Path to input CSS file (default: "_ tailwind/tailwind_input.css")
292+ - ` output_css_path ` : Path to output CSS file (default: "_ tailwind/tailwind.css")
293+ - ` config_js_path ` : Path to Tailwind config file (default: "_ tailwind/tailwind.config.js")
240294- ` cdn_url ` : CDN URL for online mode (default: "< https://cdn.tailwindcss.com > ")
241295- ` download_node ` : Whether to download Node.js if not found (default: False)
242296- ` node_version ` : Node.js version to download if download_node is True (default: "18.17.0")
@@ -324,9 +378,10 @@ All commands support the following options:
324378
325379- ` --tailwind-version VERSION ` : Version of Tailwind CSS to use (3 or 4) (default: "3")
326380- ` --content-path INPUT ` : Glob pattern for files to scan for Tailwind classes. Can be specified multiple times. (default: [ "** /* .py"] )
327- - ` --input-css-path PATH ` : Path to input CSS file (default: "./.tailwind/tailwind_input.css")
328- - ` --output-css-path OUTPUT ` : Path to output CSS file (default: "./.tailwind/tailwind.css")
329- - ` --config-js-path CONFIG ` : Path to Tailwind config file (default: "./.tailwind/tailwind.config.js")
381+ - ` --plugin-tmp-dir PATH ` : Temporary directory for plugin files (default: "./_ tailwind")
382+ - ` --input-css-path PATH ` : Path to input CSS file (default: "./_ tailwind/tailwind_input.css")
383+ - ` --output-css-path OUTPUT ` : Path to output CSS file (default: "./_ tailwind/tailwind.css")
384+ - ` --config-js-path CONFIG ` : Path to Tailwind config file (default: "./_ tailwind/tailwind.config.js")
330385- ` --tailwind-theme-config JSON ` : JSON string of custom theme configuration for Tailwind CSS
331386- ` --download-node ` : Download Node.js if not found in PATH
332387- ` --node-version VERSION ` : Node.js version to download (if --download-node is used)
@@ -356,6 +411,12 @@ Example with Tailwind CSS v4:
356411dash-tailwindcss-plugin build --tailwind-version 4
357412```
358413
414+ Example with custom plugin temporary directory:
415+
416+ ``` bash
417+ dash-tailwindcss-plugin build --plugin-tmp-dir " ./my-tailwind" --input-css-path " ./my-tailwind/input.css" --output-css-path " ./my-tailwind/output.css" --config-js-path " ./my-tailwind/config.js"
418+ ```
419+
359420## Architecture
360421
361422The plugin follows a clean, object-oriented architecture:
0 commit comments