{"name":"babel-plugin-styless","version":"1.3.1","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":{"deasync":"^0.1.13","less":"^3.8.1","less-vars-to-js":"^1.3.0","tinycolor2":"^1.4.1"},"devDependencies":{"babel-cli":"^6.26.0","babel-jest":"^23.4.2","babel-preset-env":"^1.7.0","babel-preset-react":"^6.24.1","jest":"^23.4.2","jest-styled-components":"^5.0.1","react":"^16.4.2","react-dom":"^16.4.2","react-test-renderer":"^16.4.2","semantic-release":"^15.9.9","styled-components":"^3.4.1","travis-deploy-once":"^5.0.2"},"gitHead":"1e735cd155c02e647e380a76ae3ae4521f4919de","bugs":{"url":"https://github.com/jean343/styless/issues"},"homepage":"https://github.com/jean343/styless#readme","_id":"babel-plugin-styless@1.3.1","_npmVersion":"6.4.0","_nodeVersion":"10.10.0","_npmUser":{"name":"jean343","email":"bergeron.jeanphilippe@gmail.com"},"dist":{"integrity":"sha512-bpjxCIEg1VX51Q7xk1WQWPsRg44YvQKlB64kn3Yuub9m6tzfeug4WqZbhjVOW0BLUQu98Uym/t62ULH7e9mpqQ==","shasum":"bcff7761a068a452c2cc1398f8a195d128265aab","tarball":"http://registry-npm.ywwl.com/babel-plugin-styless/download/babel-plugin-styless-1.3.1.tgz","fileCount":40,"unpackedSize":77061,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJblJRcCRA9TVsSAnZWagAAdSEP/R/N5eKqLQGP1i+iOLoG\nDtoe28kmo3zPc7rVnTSZyzCItwXYHTWilxCOfX9vdqeHEecyFCsLigTFMtN7\n9UAARKyzg4W74y+8pMMI0VQ96h2Dfmo8bqAqn09Hj4Cu7U/q8qWQ3JwePTbI\nYZ3NBCdzYbskFeEcWgyrUA9Bf+Up4HrFLeCH4vxayBrOrLHYfGFIOFIri8rx\nI5kQo6hVkQ1iXy6MT5bYtX0M/vSr9WKLd5YxBbvvTm22MgKJdp+Y2WQIhwTY\nwQsYEsp5/+v8rqGn71BHGMQ673774BMrfTZExY6gAxKsXvBJY/V8R1YqMXBr\n3Yfm4sTmBo8WXecqbIH6rnuiyGLxzZhxTGAX39YQS1Bi7NPTPBbuUzdKLZdy\n5RP5KtZozIxBIplyQU786H3Sfavri8rdP+NLH5sc7VSSBDzUnq4NEoO8h8Ml\ne84oYubPnQjl+h4nbF3lzBfo2HvY0njZGRD92X5j7w1XAstWjzX5MasqHiiz\nijRIhVsDCx5Y7xjqVJvAxEs6RYs3luy9HsbCMMwO11SD+JBZt+RUZpahtmUt\nMeBUEcyIwWmU+rpiN8NGtE9M+m/sGEfhwUhmfy6CMVEKR0qIkRZyU+yV+7ND\nypf4Z27xHWgVZEcWGni1XN9JYDDKR5mnrpjjWsxNomNOoxpMwBTcBRIs5MvR\n1IkF\r\n=75z6\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQDP70etEHw9ri0RIxeNfGAS6ZECeNKqK2KGUxpj4Zg+rQIgC2UfqIHAY1CNBc5Ape8fnJW8739p9cNYSCFZ8a6Fnu8="}],"size":17639,"noattachment":false,"key":"/babel-plugin-styless/-/babel-plugin-styless-1.3.1.tgz"},"maintainers":[{"name":"jean343","email":"bergeron.jeanphilippe@gmail.com"}],"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/babel-plugin-styless_1.3.1_1536463963325_0.5909764783269746"},"_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":1536463963546,"_cnpm_publish_time":1536463963546,"dist-tags":{"latest":"1.4.25"}}