Sitemaps and URLs
Pixeleye can crawl your sitemaps & provided URLs to automatically capture screenshots of your website. This is a really quick way to get started with Pixeleye.
We require the Pixeleye cli tool:
npm install pixeleye --save-dev
npm install pixeleye --save-dev
npm run pixeleye snapshot --sitemaps https://example.com/sitemap.xml
npm run pixeleye snapshot --sitemaps https://example.com/sitemap.xml
npm run pixeleye snapshot --urls https://example.com/page1 https://example.com/page2
npm run pixeleye snapshot --urls https://example.com/page1 https://example.com/page2
If you want to have per-page options or a more organized way to define your URLs, you can use a configuration file.
import {SnapshotDefinition} from "pixeleye";
const urls: SnapshotDefinition[] = [
{
url: "https://example.com/page1",
// options
},
{
url: "https://example.com/page2",
// options
},
// ...
];
export default urls;
import {SnapshotDefinition} from "pixeleye";
const urls: SnapshotDefinition[] = [
{
url: "https://example.com/page1",
// options
},
{
url: "https://example.com/page2",
// options
},
// ...
];
export default urls;
There is no requirement to use a specific name. But we recommend using *.pixeleye.ts
to make it clear that this file is for Pixeleye.
You can also declare the snapshot files as the main argument in pixeleye snapshot <files>
command.
import { Config } from "pixeleye";
const config: Config = {
...
snapshotFiles: ["./**/*.pixeleye.ts"],
};
export default config;
import { Config } from "pixeleye";
const config: Config = {
...
snapshotFiles: ["./**/*.pixeleye.ts"],
};
export default config;
We accept globs in the snapshotFiles
array. This means you can use ./**/*.pixeleye.ts
to include all files with the .pixeleye.ts
extension.
We support providing a function that returns an array of URLs. This is useful if you have a dynamic list of URLs that you want to capture.
import { Config, ConfigWithoutSnapshotFiles } from "pixeleye";
const config: Config = {
...
snapshotFiles: (config: ConfigWithoutSnapshotFiles) => {
return [
{
url: "https://example.com/page1",
// options
},
{
url: "https://example.com/page2",
// options
},
// ...
];
},
};
export default config;
import { Config, ConfigWithoutSnapshotFiles } from "pixeleye";
const config: Config = {
...
snapshotFiles: (config: ConfigWithoutSnapshotFiles) => {
return [
{
url: "https://example.com/page1",
// options
},
{
url: "https://example.com/page2",
// options
},
// ...
];
},
};
export default config;