Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow usage of calc for margins #154

Open
coeing opened this issue Oct 13, 2022 · 0 comments
Open

Allow usage of calc for margins #154

coeing opened this issue Oct 13, 2022 · 0 comments

Comments

@coeing
Copy link

coeing commented Oct 13, 2022

Hi! 馃憢

Firstly, thanks for your work on this project! 馃檪

I'd like to suggest that TYPES.CALC should be valid for margins as well. I used patch-package to use it in my project and it does not seem to make any problems.

The real change probably has to be done here:

type === TYPES.LENGTH ||

Today I used patch-package to patch cssstyle@2.3.0 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/cssstyle/lib/properties.js b/node_modules/cssstyle/lib/properties.js
index 7f462f3..2af2e4e 100644
--- a/node_modules/cssstyle/lib/properties.js
+++ b/node_modules/cssstyle/lib/properties.js
@@ -1225,7 +1225,7 @@ var margin_local_var_isValid = function (v) {
   }
 
   var type = external_dependency_parsers_0.valueType(v);
-  return type === margin_local_var_TYPES.LENGTH || type === margin_local_var_TYPES.PERCENT || type === margin_local_var_TYPES.INTEGER && (v === '0' || v === 0);
+  return type === margin_local_var_TYPES.CALC || type === margin_local_var_TYPES.LENGTH || type === margin_local_var_TYPES.PERCENT || type === margin_local_var_TYPES.INTEGER && (v === '0' || v === 0);
 };
 
 var margin_local_var_parser = function (v) {

This issue body was partially generated by patch-package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant