classnames-template-literals
classnames-template-literals copied to clipboard
[Question] compressing the template literals inside JS bundles ?
Hi there, 👋 Thank you for this great project 👏 , especially useful with Tailwind CSS. 😎
I was wondering if there were a webpack / babel / plugin / config that you know which could be used to compress the template literal used by ctl ?
Here is some part of my source code as an example:
...
return (
<summary
className={ctl(`
relative
block
cursor-pointer
border-b-1
border-navy-blue-100
py-10
px-2
pr-20
font-bold
dark:border-navy-blue-500
md:cursor-default
md:p-8
`)}
...
This is getting bundled as:
...
(\"summary\", {\n className: _netlify_classnames_template_literals__WEBPACK_IMPORTED_MODULE_1___default()(\"\\n relative\\n block\\n cursor-pointer\\n border-b-1\\n border-navy-blue-100\\n py-10\\n px-2\\n pr-20\\n font-bold\\n dark:border-navy-blue-500\\n md:cursor-default\\n md:p-8\\n \"
...
I wish it could be "compressed" like this:
...
(\"summary\", {\n className: _netlify_classnames_template_literals__WEBPACK_IMPORTED_MODULE_1___default()(\"relative block cursor-pointer border-b-1 border-navy-blue-100 py-10 px-2 pr-20 font-bold dark:border-navy-blue-500 md:cursor-default md:p-8\"
...
Thank you for your feedback
https://stackoverflow.com/questions/57524832/how-to-remove-n-and-t-from-webpack-compiled-template-literal