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

Already on GitHub? Sign in to your account

Feature request: parse css to/from text #1

Open
rbirdpersons opened this issue Oct 14, 2017 · 0 comments
Open

Feature request: parse css to/from text #1

rbirdpersons opened this issue Oct 14, 2017 · 0 comments

Comments

@rbirdpersons
Copy link

Would you consider adding functions to parse css to/from character strings rather than text files?

e.g.

parse_css <- function(css_text) {
  css_tbl <- css_text %>% gsub("/[*].*?[*]/", "", .) %>%
    gsub("//.?\\n", "\\n", .) %>% css:::tokenize_css()
}


create_css <- function(css_tbl) {
  css_text <- css_tbl %>%
    mutate(text = glue("{property}: {value} ; ")) %>%
    group_by(rule) %>%
    summarise(text = paste(paste("  ", text), collapse = "\n")) %>%
    mutate(glue("{rule} {{ \n{text} \n }}\n")) %>%
    pull()
}
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