mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	Using Statiq processes for tailwind commands
This commit is contained in:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							0d2a75aeee
						
					
				
				
					commit
					ab83e41051
				
			@@ -31,7 +31,7 @@
 | 
				
			|||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  <ItemGroup>
 | 
					  <ItemGroup>
 | 
				
			||||||
    <PackageReference Include="Statiq.Web" Version="1.0.0-beta.26" />
 | 
					    <PackageReference Include="Statiq.Web" Version="1.0.0-beta.27" />
 | 
				
			||||||
    <PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
 | 
					    <PackageReference Include="MinVer" PrivateAssets="All" Version="2.3.1" />
 | 
				
			||||||
  </ItemGroup>
 | 
					  </ItemGroup>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -22,6 +22,11 @@ namespace Docs
 | 
				
			|||||||
                .AddShortcode("Alert", typeof(AlertShortcode))
 | 
					                .AddShortcode("Alert", typeof(AlertShortcode))
 | 
				
			||||||
                .AddShortcode("AsciiCast", typeof(AsciiCastShortcode))
 | 
					                .AddShortcode("AsciiCast", typeof(AsciiCastShortcode))
 | 
				
			||||||
                .AddPipelines()
 | 
					                .AddPipelines()
 | 
				
			||||||
 | 
					                .AddProcess(ProcessTiming.Initialization, _ => new ProcessLauncher("npm", "install")
 | 
				
			||||||
 | 
					                {
 | 
				
			||||||
 | 
					                    LogErrors = false
 | 
				
			||||||
 | 
					                })
 | 
				
			||||||
 | 
					                .AddProcess(ProcessTiming.AfterExecution, "npm", "run", "build:tailwind")
 | 
				
			||||||
                .RunAsync();
 | 
					                .RunAsync();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        private static Config<string> ConfigureEditLink()
 | 
					        private static Config<string> ConfigureEditLink()
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,6 +1,6 @@
 | 
				
			|||||||
# Documentation
 | 
					# Documentation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
To start contributing to the [Spectre.Console](https://github.com/spectreconsole/spectre.console) documentation, you will need the [.NET Core SDK](https://dot.net) 3.1 or higher.
 | 
					To start contributing to the [Spectre.Console](https://github.com/spectreconsole/spectre.console) documentation, you will need the [.NET Core SDK](https://dot.net) 5.0.202 or higher (as defined in the repository root `global.json` file).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Running Preview Site
 | 
					## Running Preview Site
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -10,15 +10,11 @@ The documentation site uses [Statiq](https://statiq.dev), a static site generato
 | 
				
			|||||||
> Preview.ps1
 | 
					> Preview.ps1
 | 
				
			||||||
```
 | 
					```
 | 
				
			||||||
 | 
					
 | 
				
			||||||
After the build is complete, you can navigate to [http://localhost:5080/spectre.console](http://localhost:5080/spectre.console).
 | 
					After the build is complete, you can navigate to [http://localhost:5080](http://localhost:5080).
 | 
				
			||||||
 | 
					
 | 
				
			||||||
**Note that the site runs under a virtual directory.**
 | 
					## Npm
 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Building the CSS
 | 
					The site uses some tools from the JavaScript ecosystem including npm. While Statiq will execute `npm install` and other commands as needed, you need to have [npm installed](https://www.npmjs.com/get-npm) before running a site build.
 | 
				
			||||||
 | 
					 | 
				
			||||||
The documentation uses tailwind for the CSS. Committed to the repository is a large 4gb file with all possible styles at `assets/style.css`. This file is generated from the root files tailwind.config.js and tailwind.css. Any changes to the overall design style (e.g. colors, markdown styling, etc) can be made in these two files.
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 For production, `npm run build:tailwind` should be ran post Statiq build. This process will look at all the styles in the HTML and prune the tailwind file down to a much more manageable 30kb or so file.
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
## Editing Content
 | 
					## Editing Content
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -4,7 +4,7 @@
 | 
				
			|||||||
  "description": "Docs for Spectre.Console",
 | 
					  "description": "Docs for Spectre.Console",
 | 
				
			||||||
  "main": "index.js",
 | 
					  "main": "index.js",
 | 
				
			||||||
  "scripts": {
 | 
					  "scripts": {
 | 
				
			||||||
    "build:tailwind": "tailwindcss build ./tailwind.css -o ./input/assets/styles.css",
 | 
					    "build:tailwind": "tailwindcss build ./tailwind.css -o ./output/assets/styles.css",
 | 
				
			||||||
    "build": "cross-env NODE_ENV=production tailwind build tailwind.css -o ./output/assets/styles.css"
 | 
					    "build": "cross-env NODE_ENV=production tailwind build tailwind.css -o ./output/assets/styles.css"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "repository": {
 | 
					  "repository": {
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user