Switched to use strip-comments instead of Babel for CLI init command
This commit is contained in:
parent
9e26fd84e3
commit
48387a8f8a
3 changed files with 48 additions and 40 deletions
|
|
@ -1,4 +1,4 @@
|
|||
/**
|
||||
/*
|
||||
|
||||
Tailwind - The Utility-First CSS Framework
|
||||
|
||||
|
|
@ -27,7 +27,7 @@ View the full documentation at https://tailwindcss.com.
|
|||
// let defaultConfig = require('tailwindcss/defaultConfig')()
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-------------------------------------------------------------------------------
|
||||
| Colors https://tailwindcss.com/docs/colors
|
||||
|-------------------------------------------------------------------------------
|
||||
|
|
@ -131,7 +131,7 @@ let colors = {
|
|||
|
||||
module.exports = {
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Colors https://tailwindcss.com/docs/colors
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -147,7 +147,7 @@ module.exports = {
|
|||
colors: colors,
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Screens https://tailwindcss.com/docs/responsive-design
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -174,7 +174,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Fonts https://tailwindcss.com/docs/fonts
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -230,7 +230,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Text sizes https://tailwindcss.com/docs/text-sizing
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -262,7 +262,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Font weights https://tailwindcss.com/docs/font-weight
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -289,7 +289,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Leading (line height) https://tailwindcss.com/docs/line-height
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -309,7 +309,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Tracking (letter spacing) https://tailwindcss.com/docs/letter-spacing
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -328,7 +328,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Text colors https://tailwindcss.com/docs/text-color
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -344,7 +344,7 @@ module.exports = {
|
|||
textColors: colors,
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Background colors https://tailwindcss.com/docs/background-color
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -360,7 +360,7 @@ module.exports = {
|
|||
backgroundColors: colors,
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Background sizes https://tailwindcss.com/docs/background-size
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -380,7 +380,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Border widths https://tailwindcss.com/docs/border-width
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -402,7 +402,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Border colors https://tailwindcss.com/docs/border-color
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -422,7 +422,7 @@ module.exports = {
|
|||
borderColors: global.Object.assign({ default: colors['grey-light'] }, colors),
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Border radius https://tailwindcss.com/docs/border-radius
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -447,7 +447,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Width https://tailwindcss.com/docs/width
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -500,7 +500,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Height https://tailwindcss.com/docs/height
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -537,7 +537,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Minimum width https://tailwindcss.com/docs/min-width
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -557,7 +557,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Minimum height https://tailwindcss.com/docs/min-height
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -578,7 +578,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Maximum width https://tailwindcss.com/docs/max-width
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -607,7 +607,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Maximum height https://tailwindcss.com/docs/max-height
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -627,7 +627,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Padding https://tailwindcss.com/docs/padding
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -661,7 +661,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Margin https://tailwindcss.com/docs/margin
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -696,7 +696,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Negative margin https://tailwindcss.com/docs/negative-margin
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -730,7 +730,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Shadows https://tailwindcss.com/docs/shadows
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -756,7 +756,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Z-index https://tailwindcss.com/docs/z-index
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -780,7 +780,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Opacity https://tailwindcss.com/docs/opacity
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -802,7 +802,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| SVG fill https://tailwindcss.com/docs/svg
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -821,7 +821,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| SVG stroke https://tailwindcss.com/docs/svg
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -840,7 +840,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Modules https://tailwindcss.com/docs/configuration#modules
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -912,7 +912,7 @@ module.exports = {
|
|||
},
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Plugins https://tailwindcss.com/docs/plugins
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
@ -934,7 +934,7 @@ module.exports = {
|
|||
],
|
||||
|
||||
|
||||
/**
|
||||
/*
|
||||
|-----------------------------------------------------------------------------
|
||||
| Advanced Options https://tailwindcss.com/docs/configuration#options
|
||||
|-----------------------------------------------------------------------------
|
||||
|
|
|
|||
|
|
@ -55,7 +55,8 @@
|
|||
"postcss-js": "^1.0.1",
|
||||
"postcss-nested": "^3.0.0",
|
||||
"postcss-selector-parser": "^3.1.1",
|
||||
"pretty-hrtime": "^1.0.3"
|
||||
"pretty-hrtime": "^1.0.3",
|
||||
"strip-comments": "^1.0.2"
|
||||
},
|
||||
"browserslist": [
|
||||
"> 1%"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
import chalk from 'chalk'
|
||||
import { transform } from 'babel-core'
|
||||
import stripComments from 'strip-comments'
|
||||
|
||||
import * as constants from '../constants'
|
||||
import * as emoji from '../emoji'
|
||||
|
|
@ -20,11 +20,18 @@ export const optionMap = {
|
|||
noComments: ['no-comments'],
|
||||
}
|
||||
|
||||
const transformSettings = {
|
||||
ast: false,
|
||||
babelrc: false,
|
||||
compact: false,
|
||||
shouldPrintComment: comment => !comment.startsWith('*'),
|
||||
/**
|
||||
* Strips block comments from input string. Consolidates multiple line breaks.
|
||||
*
|
||||
* @param {string} input
|
||||
* @return {string}
|
||||
*/
|
||||
function stripBlockComments(input) {
|
||||
return stripComments
|
||||
.block(input)
|
||||
.replace(/\n\s*\n\s*\n/g, '\n\n') // Strip unnecessary line breaks
|
||||
.trim()
|
||||
.concat('\n')
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -48,7 +55,7 @@ export function run(cliParams, cliOptions) {
|
|||
.replace('// let defaultConfig', 'let defaultConfig')
|
||||
.replace("require('./plugins/container')", "require('tailwindcss/plugins/container')")
|
||||
|
||||
noComments && (stub = transform(stub, transformSettings).code.trim())
|
||||
noComments && (stub = stripBlockComments(stub))
|
||||
|
||||
utils.writeFile(file, stub)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue