{"name":"babel-plugin-styless","version":"1.4.15","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","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.0.0","deasync":"^0.1.13","find-babel-config":"^1.1.0","less":"^3.8.1","tinycolor2":"^1.4.1"},"devDependencies":{"babel-cli":"^6.26.0","babel-preset-env":"^1.7.0","babel-preset-react":"^6.24.1","jest":"^23.6.0","jest-styled-components":"^6.3.1","react":"^16.5.0","react-dom":"^16.5.0","react-test-renderer":"^16.5.0","semantic-release":"^15.9.15","styled-components":"^3.4.6","travis-deploy-once":"^5.0.7"},"gitHead":"d54461eb9a2924c5efbd4748fce8efe09851f718","bugs":{"url":"https://github.com/jean343/styless/issues"},"homepage":"https://github.com/jean343/styless#readme","_id":"babel-plugin-styless@1.4.15","_npmVersion":"6.4.0","_nodeVersion":"10.14.0","_npmUser":{"name":"jean343","email":"bergeron.jeanphilippe@gmail.com"},"dist":{"integrity":"sha512-yGVTIKI8q+k7+KXxA9ZXo8v5rkIlwo6eLGbaPMute5/4Lga4TnAHvPMIe1Jq5Drd7Eq+e0lyyqUqep/+lkyAQg==","shasum":"93548c518146354cd456af06ac27c08f7b33ee2d","tarball":"http://registry-npm.ywwl.com/babel-plugin-styless/download/babel-plugin-styless-1.4.15.tgz","fileCount":44,"unpackedSize":96379,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJb/fJqCRA9TVsSAnZWagAA+wMP/3RJnmiJ0GPM6HLfZbpx\ntPDf+o/7uKxj4KRFr8NjuBwmd1Aydmeg1/xYJQtu+XCWGVGlerVNMWc0Vb4V\ngen3TARGTvww0TMnpJ2F63dYnKcgmGszaw84QWzux/bhdFrj2oiDdCJZ+Cbb\n/o413n9SgrMl9ZVepgqFjW5ZT2THh/euTGv0w+9za5D2eFWwj1DSeiN66NdY\nqS7l5crFjBtFzUmVsOtsVC4Ggk1dI5qLb5ygWLFjCQi532AlmUW3kADazmzp\n+3GDKtYaCCfFQlXsnvuHoxWV0NygWo9RVmd3iUwbL1YHH/HNzcr0mcsXqftg\nGSCa3h9/Bw3O4/bDht31ZbuXNt7rQQW6aaaPTAADyXQEi6t0XlMsBl8ObFz9\nKMjpCbk06lD0hK9EguSNNuqRq9kuNtNJl0Jpot47rN6+pCE4vRtb2+Jkx2+6\ncomNFyGk+ESyQQcc+a+mtU4fyIcY6RHFw3ohajmlOsJRn5vOTDPCWhuJWbYS\nt1BMyCKLuTm5KW70F862Kjc95kBoCUnrxi8BSuY+058A++T/gsvBwK+k14wC\nKuwIfg7A46i/9FYi/r3ccUKhBvsLnLV+1tmR7QWAQ81X4+nQ6tN7BMFK4mp7\np1B5UpPnnQKPholdxqSr23KJhtlGbX5MB2/0VJ7+qJ9Hg9YdHRV+nQAouwLV\ncmEI\r\n=UM7X\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDmvV3Am0wvyWgdBgirbBrXxcEfDYdGNJ7UDkH6B/N6/wIhAONGNLy2JwNUGFkckIdva6IyXeZkzKplZrHBaoVoO7mw"}],"size":21566,"noattachment":false,"key":"/babel-plugin-styless/-/babel-plugin-styless-1.4.15.tgz"},"maintainers":[{"name":"jean343","email":"bergeron.jeanphilippe@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-styless_1.4.15_1543369322199_0.5702548317198535"},"_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":1543369322331,"_cnpm_publish_time":1543369322331,"dist-tags":{"latest":"1.4.25"}}