Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

[Question] compressing the template literals inside JS bundles ? #8

Open
francoismassart opened this issue Oct 20, 2022 · 1 comment

Comments

@francoismassart
Copy link

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

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant