Bootcamp
Search…
2.POCE.3: CSS Processor

Setup

Start with the base Node repo.

Base

Write a program that takes in a CSS file and changes all colours from hex to RGB.

styles.css

body {
background-color: #ffffff;
}
​
p {
background-color: #000000;
}
​
span {
background-color: #000000;
}

Sample Command

node index.js styles.css

Sample Subsequent styles.css

body {
background-color: rgb(255, 255, 255);
}
​
p {
background-color: rgb(0, 0, 0);
}
​
span {
background-color: rgb(0, 0, 0);
}

Comfortable

Processor Options

Allow the user to convert from hex to RGB, or from RGB to hex.
node index.js rgbtohex styles.css
node index.js hextorgb styles.css

More Comfortable

Auto Format

Automatically convert any hex to RGB and vice-versa.
node index.js styles.css

Lint Suggestions

  1. 1.
    If there is a missing curly brace, suggest on the command line where the user might insert it.
  2. 2.
    If there is a missing quote mark, suggest on the command line where the user might insert it.

Reference solution

Click here to see the reference solution for this post class.
Copy link
On this page
Setup
Base
Comfortable
Processor Options
More Comfortable
Auto Format
Lint Suggestions
Reference solution