Push CSS to Project Wallace with a webhook
The most accurate analysis of your CSS is possible when you push your changes to Project Wallace whenever you make them. This can be done manually by hitting a button in our website, but whenever you push new code to your production website, you can also send a message to projectwallace.com with your new CSS. The best place to do this would be somewhere in your CI/CD process (if you have one). Here is how to do that in the terminal with cURL.
A couple of things are worth noting:
?token=YOUR_PROJECT_TOKEN
should contain the actual token of your project. This can be found in any project’s settings page.- The request method must be
POST
. - The
Content-Type
header must betext/plain
(In v1 this used to betext/css
)
cURL request with CSS inline
This example shows how to send the CSS along as an inline string.
curl https://www.projectwallace.com/api/webhooks/v2/imports?token=YOUR_PROJECT_TOKEN
--request POST
--header 'Content-Type: text/plain'
--data 'html { color: #bada55; }'
cURL request with CSS sent as file
This example shows how to send the CSS along as a file.
curl https://www.projectwallace.com/api/webhooks/v2/imports?token=YOUR_PROJECT_TOKEN
--request POST
--header 'Content-Type: text/plain'
--data @path/to/style.css
cURL request with CSS read from stdin
This example shows how to send the CSS along when it’s read fron stdin
.
# First, read the file contents with `cat`
cat path/to/style.css |
# then post it to Project Wallace
curl https://www.projectwallace.com/api/webhooks/v2/imports?token=YOUR_PROJECT_TOKEN
--request POST
--header 'Content-Type: text/plain'
--data @-