Package 'rless'

Title: Leaner Style Sheets
Description: Converts LESS to CSS. It uses V8 engine, where LESS parser is run. Functions for LESS text, file or folder conversion are provided. This work was supported by a junior grant research project by Czech Science Foundation 'GACR' no. 'GJ18-04150Y'.
Authors: Jonas Vaclavek [aut, cre], Jakub Kuzilek [aut]
Maintainer: Jonas Vaclavek <[email protected]>
License: MIT + file LICENSE
Version: 0.1.1
Built: 2025-03-12 04:44:46 UTC
Source: https://github.com/ciirc-kso/rless

Help Index


Converts content of file to CSS

Description

Passes content of file_name into V8 console and converts it using LESS engine to CSS. The converted CSS is saved into output_folder under original name. Only the extension is switched to css.

Usage

convert_file(base_path, file_name, output_folder = tempdir())

Arguments

base_path

Base path to file to be converted

file_name

Path relative to base_path leading to file to be converted

output_folder

Output path where converted file should be placed. File is placed to tempdir by default

Value

Full path to created file with converted CSS file

Examples

path_to_less_files <- system.file("extdata", package="rless")

convert_file(path_to_less_files, "example.less")
convert_file(path_to_less_files, "example.less", tempdir())

Converts files in folder to CSS files

Description

Function goes through folder specified in input_folder and finds files matching the pattern. If recursive is set to TRUE, scanner are also subdirectories of the input_folder. Matching files are converted using convert_file function.

Usage

convert_folder(input_folder, output_folder = tempdir(),
  recursive = FALSE, pattern = "*.less$")

Arguments

input_folder

Path to files to be converted

output_folder

Output path where converted files should be placed Files are placed to tempdir by default

recursive

Boolean value used when searching for filed to be converted

pattern

Pattern which files need to match to be converted

Value

List of file paths to converted files is returned

Examples

path_to_less_files <- system.file("extdata", package="rless")

convert_folder(path_to_less_files)
convert_folder(path_to_less_files, tempdir())
convert_folder(path_to_less_files, recursive = TRUE)
convert_folder(path_to_less_files, pattern = '*.css$')

Parse LESS content to CSS

Description

Parse LESS file to CSS and return it as result

Usage

parse_less(code)

Arguments

code

text to be converted in LESS format

Details

Currently LESS '@import' functionality is not supported.

Value

converted text to CSS

Examples

parse_less('.button { .red{ collor: red}}')
parse_less('@red: red; .red{ collor: @red}')

rless: css preprocessor R library

Description

rless is R package providing CSS preprocessor features to R users.

Details

It uses LESS language, which is an CSS extension giving option to use variables, functions or using operators while creating styles. Visit oficial LESS website (http://lesscss.org) for more information about language specifics. The provided LESS content is converted into CSS using V8 JavaScript engine (https://v8.dev/).

Author(s)

Maintainer: Jonas Vaclavek [email protected]

Authors:

  • Jakub Kuzilek

See Also

Useful links: