{"id":22710567,"url":"https://github.com/smallhelm/less-to-js","last_synced_at":"2025-03-29T21:42:39.687Z","repository":{"id":23762612,"uuid":"27137182","full_name":"smallhelm/less-to-js","owner":"smallhelm","description":"Turn .less files into isomorphic (browser and node) .js - i.e. require('./somefile.less.js'); ","archived":false,"fork":false,"pushed_at":"2017-04-20T20:36:15.000Z","size":38,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-04T22:28:05.735Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"CSS","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/smallhelm.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-11-25T17:21:11.000Z","updated_at":"2018-03-21T01:29:46.000Z","dependencies_parsed_at":"2022-08-22T05:50:46.098Z","dependency_job_id":null,"html_url":"https://github.com/smallhelm/less-to-js","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fless-to-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fless-to-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fless-to-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/smallhelm%2Fless-to-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/smallhelm","download_url":"https://codeload.github.com/smallhelm/less-to-js/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246249226,"owners_count":20747167,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T12:10:31.280Z","updated_at":"2025-03-29T21:42:39.666Z","avatar_url":"https://github.com/smallhelm.png","language":"CSS","funding_links":[],"categories":[],"sub_categories":[],"readme":"# less-to-js\n\n[![build status](https://secure.travis-ci.org/smallhelm/less-to-js.svg)](https://travis-ci.org/smallhelm/less-to-js)\n\nWhat it does\n------------\nTurns `.less` files into `.js` files that can run in the browser or in node. (just does nothing in node)\n\nhello.less\n```less\n.hello {\n  .world {\n    color: lighten(red, 20%);\n  }\n}\n```\nturns into\n\nhello.less.js\n```javascript\n(function(e){if(\"undefined\"!=typeof document){var t=document;if(t.less_to_js__inserted=t.less_to_js__inserted||{},!t.less_to_js__inserted[e]){t.less_to_js__inserted[e]=!0;var s=t.createElement(\"style\");s.setAttribute(\"type\",\"text/css\"),\"textContent\"in s?s.textContent=e:s.styleSheet.cssText=e,t.getElementsByTagName(\"head\")[0].appendChild(s)}}}(\".hello .world{color:#f66}\"));\n```\n\nWhich can then be used in the browser or server. For example requried in a project using browserify\n\napp.js\n```javascript\nrequire('./hello.less.js');\n```\n\nHow to use it\n-------------\n\n### Command Line\ninstall\n```sh\n$ sudo npm install -g less-to-js\n```\nsimply run it with file path globs that you want to compile\n```sh\n$ less-to-js src/**/*.css src/**/*.less\n```\n\n### Node API\ninstall\n```sh\n$ npm install less-to-js\n```\nUsage example\n```javascript\nvar less_to_js = require(\"less-to-js\");\n\nvar file = \"./asdf.less\";\n\nless_to_js(file, function(err){\n  console.log(err ? \"failed!\" : \"Done! created \" + file + \".js\");\n});\n```\n\n## License\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fless-to-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsmallhelm%2Fless-to-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsmallhelm%2Fless-to-js/lists"}