|
121 | 121 |
|
122 | 122 | <Container> |
123 | 123 | <div class="output"> |
| 124 | + {#if status === STATUS.ERROR || status === STATUS.REMOTE_ERROR} |
| 125 | + <p class="error" data-testid="error-message"> |
| 126 | + {#if status === STATUS.ERROR} |
| 127 | + Something went wrong |
| 128 | + {:else if status === STATUS.REMOTE_ERROR} |
| 129 | + {errorMessage} |
| 130 | + {/if} |
| 131 | + </p> |
| 132 | + {/if} |
| 133 | + |
124 | 134 | <header> |
125 | 135 | <Label for="scraped-css">Scraped CSS</Label> |
126 | 136 | {#if status === STATUS.DONE} |
|
138 | 148 | {/if} |
139 | 149 | </div> |
140 | 150 | </div> |
141 | | - |
142 | | - {#if status === STATUS.ERROR || status === STATUS.REMOTE_ERROR} |
143 | | - <p class="error"> |
144 | | - {#if status === STATUS.ERROR} |
145 | | - Something went wrong |
146 | | - {:else if status === STATUS.REMOTE_ERROR} |
147 | | - {errorMessage} |
148 | | - {/if} |
149 | | - </p> |
150 | | - {/if} |
151 | 151 | </Container> |
152 | 152 |
|
153 | 153 | <Container size="md"> |
154 | 154 | <Markdown> |
155 | | - <p>This CSS scraper loads the HTML of your website and goes through all the <code><link></code> and <code><style></code> tags to (recursively) find CSS.</p> |
| 155 | + <p> |
| 156 | + This CSS scraper loads the HTML of your website and goes through all the <code><link></code> and |
| 157 | + <code><style></code> tags to (recursively) find CSS. |
| 158 | + </p> |
156 | 159 |
|
157 | 160 | <ol> |
158 | 161 | <li>Load the HTML for the URL you fill in</li> |
159 | 162 | <li>Find all <code><link rel="stylesheet"></code> tags and load the CSS from the <code>href</code> URL</li> |
160 | 163 | <li>Find all <code><style></code> tags and extract the CSS from it's contents</li> |
161 | | - <li>Find all CSS <code>@import</code> statements in the CSS we just loaded and load the CSS from the <code>@import</code>'s URL</li> |
162 | | - <li>Go through all the DOM elements that have a non-empty <code>style="…"</code> attribute. Create a CSS Ruleset for each DOM node and add it to 1 single origin that contains all inline styles.</li> |
| 164 | + <li> |
| 165 | + Find all CSS <code>@import</code> statements in the CSS we just loaded and load the CSS from the |
| 166 | + <code>@import</code>'s URL |
| 167 | + </li> |
| 168 | + <li> |
| 169 | + Go through all the DOM elements that have a non-empty <code>style="…"</code> attribute. Create a CSS Ruleset |
| 170 | + for each DOM node and add it to 1 single origin that contains all inline styles. |
| 171 | + </li> |
163 | 172 | <li>Combine all the CSS</li> |
164 | 173 | </ol> |
165 | 174 |
|
166 | | - <p>Once it's on the page here you can inspect each separate CSS origin in the Network Panel. From there you can see what we found and where it originated from. It also shows the <code>media</code> type in case of a <code><link></code> tag, as well as the <code>rel="…"</code>. For all origins it shows the total filesize.</p> |
| 175 | + <p> |
| 176 | + Once it's on the page here you can inspect each separate CSS origin in the Network Panel. From there you can see |
| 177 | + what we found and where it originated from. It also shows the <code>media</code> type in case of a |
| 178 | + <code><link></code> |
| 179 | + tag, as well as the <code>rel="…"</code>. For all origins it shows the total filesize. |
| 180 | + </p> |
167 | 181 |
|
168 | | - <hr> |
| 182 | + <hr /> |
169 | 183 |
|
170 | | - <p>If you want to learn more about CSS scraping you can read it in our blog post <a href="/blog/ways-to-scrape-css">3 ways to scrape CSS from a website</a>. Here we explain the possible angles and the pros and cons of each approach.</p> |
| 184 | + <p> |
| 185 | + If you want to learn more about CSS scraping you can read it in our blog post <a href="/blog/ways-to-scrape-css" |
| 186 | + >3 ways to scrape CSS from a website</a |
| 187 | + >. Here we explain the possible angles and the pros and cons of each approach. |
| 188 | + </p> |
171 | 189 | </Markdown> |
172 | 190 | </Container> |
173 | 191 |
|
|
0 commit comments