Website Structure
This commit is contained in:
parent
62812f2090
commit
71f0676a62
22365 changed files with 4265753 additions and 791 deletions
31
Frontend-Learner/node_modules/tailwind-config-viewer/cli/export.js
generated
vendored
Normal file
31
Frontend-Learner/node_modules/tailwind-config-viewer/cli/export.js
generated
vendored
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
const fs = require('fs-extra')
|
||||
const path = require('path')
|
||||
const crypto = require('crypto')
|
||||
const replace = require('replace-in-file')
|
||||
const { resolveConfigToJson } = require('../lib/tailwindConfigUtils')
|
||||
|
||||
module.exports = async function (outputDir, configPath) {
|
||||
outputDir = path.resolve(process.cwd(), outputDir)
|
||||
|
||||
fs.removeSync(outputDir)
|
||||
fs.mkdirSync(outputDir)
|
||||
|
||||
const configJson = await resolveConfigToJson(configPath)
|
||||
const configFileName = generateConfigFileNameFromJson(configJson)
|
||||
|
||||
fs.writeFileSync(path.resolve(outputDir, configFileName), configJson)
|
||||
|
||||
fs.copySync(path.resolve(__dirname, '../dist'), outputDir)
|
||||
|
||||
replace.sync({
|
||||
files: `${outputDir}/index.html`,
|
||||
from: 'config.json',
|
||||
to: configFileName
|
||||
})
|
||||
}
|
||||
|
||||
function generateConfigFileNameFromJson (configJson) {
|
||||
const configFileHash = crypto.createHash('md5').update(configJson).digest('hex')
|
||||
|
||||
return `config.${configFileHash.substr(0, 8)}.json`
|
||||
}
|
||||
36
Frontend-Learner/node_modules/tailwind-config-viewer/cli/index.js
generated
vendored
Normal file
36
Frontend-Learner/node_modules/tailwind-config-viewer/cli/index.js
generated
vendored
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
#!/usr/bin/env node
|
||||
const { pathToFileURL } = require('url')
|
||||
const { resolveConfigPath } = require('../lib/tailwindConfigUtils')
|
||||
const program = require('commander')
|
||||
program
|
||||
.option('-c, --config <path>', 'Path to your Tailwind config file', './tailwind.config.js')
|
||||
|
||||
program
|
||||
.command('serve', { isDefault: true })
|
||||
.description('Serve the viewer')
|
||||
.option('-p, --port <port>', 'Port to run the viewer on', 3000)
|
||||
.option('-o, --open', 'Open the viewer in default browser')
|
||||
.action(args => {
|
||||
require('../server')({
|
||||
port: args.port,
|
||||
tailwindConfigProvider: async () => {
|
||||
const configPath = resolveConfigPath(program.config)
|
||||
const configHref = pathToFileURL(configPath).href
|
||||
delete require.cache[configHref]
|
||||
const config = await import(configHref)
|
||||
return config.default || config
|
||||
},
|
||||
shouldOpen: args.open
|
||||
}).start()
|
||||
})
|
||||
|
||||
program
|
||||
.command('export [outputDir]')
|
||||
.description('Create a static export of the viewer')
|
||||
.action((outputDir = './tcv-build') => {
|
||||
const configPath = resolveConfigPath(program.config)
|
||||
const configHref = pathToFileURL(configPath).href
|
||||
require('./export')(outputDir, configHref)
|
||||
})
|
||||
|
||||
program.parse(process.argv)
|
||||
Loading…
Add table
Add a link
Reference in a new issue