UNPKG

salutecss

Version:

A enchanced, lightweight and fast utility-first CSS

46 lines (34 loc) 1.15 kB
#!/usr/bin/env node const { build } = require('../index.js') const showHelpCommand = () => console.log(`Usage: salute [command] [options] Commands: build Compile styles once help Shows the Help Options: --input Input file/directory path (required) --output Output file path (default: salute.css) Examples: $ salute build --input src/index.html $ salute build --input src/**/*.js --output public/styles.css $ salute build`) const parseArguments = () => { const args = process.argv.slice(2) const options = {} for (let i = 0; i < args.length; i++) { if (args[i].startsWith('--')) { const key = args[i].replace(/^--?/, '') if (['input', 'output'].includes(key)) options[key] = args[++i] } } return { command: args[0], ...options } } const { command, ...args } = parseArguments() if (command === 'build') { const start = Date.now() build({ args }) console.log(`SaluteCSS: Build successfully completed in ${Date.now() - start}ms`) } else if (command === 'help') showHelpCommand() else console.log('Invalid Command: try to get more informations at "salute help"')