Skip to content

[Snippet] SASS function to convert px to rem #178

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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jan 5, 2025
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 26 additions & 0 deletions .github/workflows/auto-sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Auto Sync with Main Repo

on:
push:
branches:
- main

jobs:
sync:
runs-on: ubuntu-latest

steps:
- name: Checkout Target Repository
uses: actions/checkout@v2
with:
repository: gihanrangana/quicksnip
ref: main
token: ${{ secrets.GITHUB_TOKEN }}

- name: Sync with Main Repository
run: |
git remote add upstream https://github.com/gihanrangana/quicksnip.git
git fetch upstream
git checkout main
git merge upstream/main
git push origin main
2 changes: 1 addition & 1 deletion public/consolidated/c.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"numbers"
],
"contributors": [],
"code": "#include<stdio.h>\nvoid swap(int* num1,int* num2){\n *num1 = *num1 + *num2;\n *num2 = *num1 - *num2;\n *num1 = *num1 - *num2;\n}\n\n// Usage:\nint a = 3,b = 4;\nswap(&a,&b); // simply use printf after this to print swapped values\n"
"code": "#include<stdio.h>\nvoid swap(int* num1,int* num2){\n *num1 = *num1 + *num2;\n *num2 = *num1 - *num2;\n *num1 = *num1 - *num2;\n}\n\n// Usage:\nint a = 3,b = 4;\nswap(&a,&b); // swaps the values of the a and b variables\n"
}
]
}
Expand Down
15 changes: 15 additions & 0 deletions public/consolidated/scss.json
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,21 @@
"contributors": [],
"code": "@mixin line-clamp($number) {\n display: -webkit-box;\n -webkit-box-orient: vertical;\n -webkit-line-clamp: $number;\n overflow: hidden;\n}\n"
},
{
"title": "PX to REM Helper",
"description": "This function will convert px values to rem values.",
"author": "gihanrangana",
"tags": [
"sass",
"function",
"pixel",
"rem",
"px-to-rem",
"css"
],
"contributors": [],
"code": "@function px-to-rem($px, $base: 16px) {\n @return ($px / $base) * 1rem;\n}\n\n// Usage\ndiv {\n font-size: px-to-rem(12px); // Output: 0.75rem\n padding: px-to-rem(16px); // Output: 1rem\n margin: px-to-rem(32px) // Output 2rem\n}\n"
},
{
"title": "Text Gradient",
"description": "Adds a gradient color effect to text.",
Expand Down
19 changes: 19 additions & 0 deletions snippets/scss/typography/px-to-rem-helper.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
---
title: PX to REM Helper
description: This function will convert px values to rem values.
author: gihanrangana
tags: sass,function,pixel,rem,px-to-rem,css
---

```scss
@function px-to-rem($px, $base: 16px) {
@return ($px / $base) * 1rem;
}

// Usage
div {
font-size: px-to-rem(12px); // Output: 0.75rem
padding: px-to-rem(16px); // Output: 1rem
margin: px-to-rem(32px) // Output 2rem
}
```