{"name":"babel-plugin-styless","version":"1.4.25","description":"Style your components declaratively with familiar less syntax","main":"dist/index.js","source":"src/index.js","repository":{"type":"git","url":"git+https://github.com/jean343/styless.git"},"author":{"name":"Jean-Philippe Bergeron","email":"bergeron.jeanphilippe@gmail.com"},"license":"MIT","scripts":{"test":"yarn run clean && yarn run build && jest","watch":"jest --watch --no-cache","clean":"jest --clearCache","build":"babel -d dist/ src/","prepare":"yarn run build","prepublishOnly":"npm run build","semantic-release":"semantic-release","travis-deploy-once":"travis-deploy-once"},"jest":{"testURL":"http://localhost/"},"dependencies":{"@babel/generator":"^7.6.4","find-babel-config":"^1.2.0","less":"3.9.0","tinycolor2":"^1.4.1"},"devDependencies":{"@babel/cli":"^7.6.4","@babel/preset-env":"^7.6.3","@babel/preset-react":"^7.6.3","@scoped/package":"link:./test/packages/scoped-package","babel-plugin-styled-components":"^1.10.6","jest":"^24.9.0","jest-styled-components":"^6.3.3","react":"^16.11.0","react-dom":"^16.11.0","react-test-renderer":"^16.11.0","semantic-release":"^15.13.30","styled-components":"^4.4.1","travis-deploy-once":"^5.0.11"},"gitHead":"68a37e565125b69fb81cf19056dd7f35bddacf06","bugs":{"url":"https://github.com/jean343/styless/issues"},"homepage":"https://github.com/jean343/styless#readme","_id":"babel-plugin-styless@1.4.25","_nodeVersion":"12.13.0","_npmVersion":"6.10.0","dist":{"integrity":"sha512-p/YDGram54+xv2+GxRvoH2I4cL2/E6txw/oHL+7OwZX/blov7/CwlFMVjFIzvYY+LZedCq6HZiNMIbGmyNwRag==","shasum":"5511ef600bd1c6af61e95a4926291c7bd52f3f2c","tarball":"http://registry-npm.ywwl.com/babel-plugin-styless/download/babel-plugin-styless-1.4.25.tgz","fileCount":44,"unpackedSize":101541,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJdvhMXCRA9TVsSAnZWagAAI4EP+wWKzfE5tEsNQRkdVPxj\nYmLbUi1XcDDxn2kATut14at9SbJsfg4JUGQaySfuXDKyz0cLxsJgKWDnC2CP\n7jhYUiruxhrPF13ur5EKfaWkGqgzWJqClf2RRdqkjDdxEruDRUimArPSbF9V\nnaKmoSHcbA1DlYnD8R1yfVF8PD9t1rSf3mkOWGF3drapKdsC5LbNZioXuar4\njWgXB0AmH7z5gIkg2eV88RWlRcEglbbklLruWJGwjPHizFzngkK4zDWt8wYF\ni3w5qN7aUmKLM9AuKiVIDsM5bQvlCiohzQf2zr4Zxn2/EBLyiNwkwsAxrf4f\nkVGjd/B+j/wOIlVOFYQWabe/7PsweFNL31Whu3aC4egCwlQ+IP/IB2R2nKlL\nq2KBkF3Dgrh+BvikAryn+ukOXHfbK73aQrO4ju//iEIXo5NBPCH2OuswJLOC\n+PFFahTR7DxYpere53NrAnaAbTMGK0onDbaaS2R0qDcu5YWs8Tcc+//86q6Z\numImLZztwEPbAESWxDYu8KcOIY1Zd+SMwY5gGJ2xxDyJMOsdG3iBbQiT9gcG\ngBmiCvzshxcYhqsy5muUn4WicG76MhPd9IRZvZafrPU/kitiZNSgAlgERdFW\nOBCEpFbB/GiBtvTdnR2gONfyB1qfsCO9LFPrntOxdeJxWln0nBiCeaWO9LI8\npd8F\r\n=15Ia\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIAxg0uI3vscomTLyo2UdlS1Vy+3dfJNCHJguYcmO3dnvAiAcvVCTIVB+BSdA7Nk8BhWfQYVb74eGIOrB2+wBv+Wqag=="}],"size":20603,"noattachment":false,"key":"/babel-plugin-styless/-/babel-plugin-styless-1.4.25.tgz"},"maintainers":[{"name":"jean343","email":"bergeron.jeanphilippe@gmail.com"}],"_npmUser":{"name":"jean343","email":"bergeron.jeanphilippe@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-styless_1.4.25_1572737814824_0.4782203906245548"},"_hasShrinkwrap":false,"readme":"[![Build Status](https://travis-ci.org/jean343/styless.svg?branch=master)](https://travis-ci.org/jean343/styless)\n[![npm](https://img.shields.io/npm/v/babel-plugin-styless.svg)](https://www.npmjs.com/package/babel-plugin-styless)\n[![semantic-release](https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg)](https://github.com/semantic-release/semantic-release)\n[![style: styled-components](https://img.shields.io/badge/style-%F0%9F%92%85%20styled--components-orange.svg?colorB=daa357&colorA=db748e)](https://github.com/styled-components/styled-components)\n\n# :gem:Styless:gem:\n\nStyless enables [less](http://lesscss.org/) syntax in your [styled-components](https://www.styled-components.com)\n\n## Installation\n```sh\n$ yarn add --dev babel-plugin-styless\n```\n\n**.babelrc**\n\n```json\n{\n  \"plugins\": [\"babel-plugin-styless\"]\n}\n```\n\nNote that `styless` should appear before `babel-plugin-styled-components` if used.\n\n## Key features\n- Simplifies the code\n\n    use `@main` instead of `${props => props.theme.main}`\n\n- Uses variables directly in your styled components\n```less\n    @size: if(@small, 4px, 10px);\n```\n\n- Uses operations directly in your styled components\n\n    use `@size * 3` instead of `${props => parseFloat(props.size) * 3 + \"px\"}`\n\n- Uses functions directly in your styled components.\n```less\n    color: darken(@highlight, 5%);\n```\n    There is no need to import `darken`.\n\n- Supports `rgb`, `hsl` and `hsv` color spaces\n```less\n    color: hsv(90, 100%, 50%);\n```\n\n- Migrate less to styled-components seamlessly.\n\n    There is no confusion when transitioning from less to styled-components caused by `width: 3px * 2`.\n\n- Supports variable overwritten\n```less\n    const Button = styled.button`\n        @highlight: blue;                           // can be overwritten by theme or props\n        background: darken(@highlight, 5%);         // make green darken by 5%\n    `;\n```\n\n```jsx   \n    <ThemeProvider theme={{highlight: \"red\"}}>\n        <Button highlight=\"green\">click me</Button> // green (set in props) overwrites red (set in theme)\n    </ThemeProvider>\n```\n\n- Supports imports and mixins\n```less\n    const Button = styled.button`\n        @import (reference) \"variables\";\n        .bg-light-blue;\n    `;\n```\n\n- Supports css props\n```less\n    <button css=\"color: @color;\"/>\n    <button css={`color: @color;`}/>\n    <button css={css`color: @color;`}/>\n```\n\n- Still supports the styled-components syntax for more complex jobs!\n```jsx\n    `${props => props.main}`\n```\n\n## Your first Styless component\n```less\nconst Button = styled.button`\n    @main: palevioletred;\n    @size: 1em;\n    \n    font-size: @size;\n    margin: @size;\n    padding: @size / 4 @size;\n    border-radius: @size / 2;\n    \n    color: @main;\n    border: 2px solid @main;\n    background-color: white;\n`;\n```\n```jsx\n<Button>Normal</Button>\n<Button main=\"mediumseagreen\">Themed</Button>\n<Button main=\"mediumseagreen\" size=\"1.5em\">Themed large</Button>\n```\n\nThis is what you'll see in your browser :tada:, play with it on [codesandbox](https://codesandbox.io/s/p30ywzqkr7)\n\n![](https://i.imgur.com/vb7wo7i.png)\n\n## Advanced Styless component example\n```less\nconst Button = styled.button`\n    @faded: fade(black, 21%);\n    @size: if(@small, 4px, 10px);\n    cursor: pointer;\n    cursor: if(@disabled, not-allowed);\n    color: hsv(0, 0%, 99%);\n    padding: @size @size * 3;\n    border: 1px solid @faded;\n    border-bottom: 4px solid @faded;\n    border-radius: ${4}px;\n    text-shadow: 0 1px 0 @faded;\n    background: linear-gradient(@highlight 0%, darken(@highlight, 5%) 100%);\n    &:active {\n        background: darken(@highlight, 10%);\n    }\n`;\n```\n```jsx\n// Notice that the @highlight variable is resolved from the theme, and overwritten from a props in the second button.\n<ThemeProvider theme={{highlight: \"palevioletred\"}}>\n    <Button>Click me</Button>\n    <Button highlight=\"hsl(153, 100%, 33%)\">Or me</Button>\n    <Button disabled small>But not me</Button>\n</ThemeProvider>\n```\n\nThis is what you'll see in your browser :tada:, play with it on [codesandbox](https://codesandbox.io/s/6zq4jyo5qz)\n\n![](https://i.imgur.com/01eETHm.png)\n\n\n*Note* that with [webstorm-styled-components](https://github.com/styled-components/webstorm-styled-components),\nwe get syntax highlighting, color preview and ctrl+click access to variables!\n![](https://i.imgur.com/t8Qw6ty.png\")\n\n## FAQ\n - How to refer to a `constants.less` file, see the receipe for [theme](docs/receipe-theme.md).\n - Cool, how does it work? Head over to the [explanations](docs/explanation.md).\n - Why less? The `@color` systax reduces the confusion from `$color` when comparing to the SC syntax `${props}`. If there is enough demand, a scss plugin could be created.\n - The styled-components mixins such as `${hover};` must be terminated with a semi colon. The following will not work. \n```less\nconst Button = styled.button`\n  ${hover}\n  color: red;\n`;\n```\n - How to import a less files for all components? As SC components are small in nature, it can be convenient to have a common less file be imported in all components. Add the following to your `.babelrc` to have `common.less` imported automatically.\n ```\n [\n   \"styless\",\n   {\n     \"cwd\": \"babelrc\",\n     \"import\": \"../less/common.less\"\n   }\n ]\n```\n","publish_time":1572737814961,"_cnpm_publish_time":1572737814961,"dist-tags":{"latest":"1.4.25"}}