less-plugin-remcalc
Advanced tools
Comparing version 0.0.1 to 0.1.0
@@ -20,4 +20,3 @@ # Contributing to project ovh-ui-kit | ||
The contributions should be submitted through Github Pull Requests and | ||
follow the DCO which is defined below. | ||
The contributions should be submitted through Github Pull Requests. | ||
@@ -32,48 +31,2 @@ # Licensing for new files | ||
# Developer Certificate of Origin (DCO) | ||
To improve tracking of contributions to this project we will use a | ||
process modeled on the modified DCO 1.1 and use a "sign-off" procedure | ||
on patches that are being emailed around or contributed in any other | ||
way. | ||
The sign-off is a simple line at the end of the explanation for the | ||
patch, which certifies that you wrote it or otherwise have the right | ||
to pass it on as an open-source patch. The rules are pretty simple: | ||
if you can certify the below: | ||
``` | ||
By making a contribution to this project, I certify that: | ||
(a) The contribution was created in whole or in part by me and I have | ||
the right to submit it under the open source license indicated in | ||
the file; or | ||
(b) The contribution is based upon previous work that, to the best of | ||
my knowledge, is covered under an appropriate open source License | ||
and I have the right under that license to submit that work with | ||
modifications, whether created in whole or in part by me, under | ||
the same open source license (unless I am permitted to submit | ||
under a different license), as indicated in the file; or | ||
(c) The contribution was provided directly to me by some other person | ||
who certified (a), (b) or (c) and I have not modified it. | ||
(d) The contribution is made free of any other party's intellectual | ||
property claims or rights. | ||
(e) I understand and agree that this project and the contribution are | ||
public and that a record of the contribution (including all | ||
personal information I submit with it, including my sign-off) is | ||
maintained indefinitely and may be redistributed consistent with | ||
this project or the open source license(s) involved. | ||
``` | ||
then you just add a line saying | ||
Signed-off-by: Random J Developer <random@developer.org> | ||
using your real name (sorry, no pseudonyms or anonymous contributions.) | ||
# Setup your environment | ||
@@ -128,2 +81,1 @@ | ||
All commits in this project must follow this specific message convention: <https://gist.github.com/stephenparish/9941e89d80e2bc58a153> | ||
@@ -1,7 +0,47 @@ | ||
import functions from './functions'; | ||
var functions = function (less) { | ||
const registry = less.functions.functionRegistry; | ||
const Dimension = less.tree.Dimension; | ||
export default { | ||
install: (less) => { | ||
return { | ||
'rem-base': (base) => { | ||
if (!base) { | ||
return less.data['rem-base'] || new Dimension(16, 'px'); | ||
} | ||
base = new Dimension(registry.get('unit')(base).value, 'px'); | ||
less.data['rem-base'] = base; | ||
return base; | ||
}, | ||
'rem-calc': (value, base) => { | ||
base = base || registry.get('rem-base')(); | ||
const baseUnit = registry.get('get-unit')(base).value.backupUnit; | ||
base = registry.get('unit')(base).value; | ||
if (baseUnit === '%') { | ||
base = (base / 100) * 16; | ||
} | ||
if (baseUnit === 'rem') { | ||
base *= 16; | ||
} | ||
if (baseUnit === 'em') { | ||
base *= 16; | ||
} | ||
if (!value) { | ||
return new Dimension(0); | ||
} | ||
const calculus = parseFloat((value.value / base).toFixed(3)); | ||
return new Dimension(calculus, 'rem'); | ||
}, | ||
}; | ||
}; | ||
module.exports = { | ||
install: function (less) { | ||
less.functions.functionRegistry.addMultiple(functions(less)); | ||
}, | ||
} | ||
}; |
{ | ||
"name": "less-plugin-remcalc", | ||
"description": " Simply adds rem-base and rem-calc functions to LESS", | ||
"version": "0.0.1", | ||
"main": "dist/plugin.js", | ||
"version": "0.1.0", | ||
"keywords": [ | ||
"less plugins", | ||
"remcalc", | ||
"rem-calc" | ||
], | ||
"main": "lib/index.js", | ||
"engines": { | ||
"node": ">=4" | ||
}, | ||
"license": "BSD-3-Clause", | ||
"repository": { | ||
"type": "git", | ||
"url": "https://github.com/ovh-ux/less-plugin-remcalc.git" | ||
}, | ||
"bugs": { | ||
"url": "https://github.com/ovh-ux/less-plugin-remcalc/issues" | ||
}, | ||
"scripts": { | ||
"build": "webpack", | ||
"lint": "eslint lib", | ||
@@ -14,12 +28,7 @@ "test": "node test" | ||
"devDependencies": { | ||
"babel-core": "^6.22.1", | ||
"babel-loader": "^6.2.10", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-preset-es2015": "^6.22.0", | ||
"eslint": "^3.13.1", | ||
"eslint-config-airbnb-base": "^11.0.1", | ||
"eslint-plugin-import": "^2.2.0", | ||
"less": "^2.7.2", | ||
"webpack": "^1.14.0" | ||
"less": "^3.8.1" | ||
} | ||
} |
# less-plugin-remcalc | ||
![OVH component](https://user-images.githubusercontent.com/3379410/27423240-3f944bc4-5731-11e7-87bb-3ff603aff8a7.png) | ||
Simply adds `rem-base` and `rem-calc` functions to LESS. | ||
[![NPM](https://nodei.co/npm/less-plugin-remcalc.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/less-plugin-remcalc/) | ||
## Installation | ||
``` | ||
yarn add --dev "git@github.com:ovh-ux/less-plugin-remcalc.git" | ||
yarn add --dev less-plugin-remcalc | ||
``` | ||
@@ -10,0 +14,0 @@ |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No repository
Supply chain riskPackage does not have a linked source code repository. Without this field, a package will have no reference to the location of the source code use to generate the package.
Found 1 instance in 1 package
4
2
95
1
53848
17
69
2