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

Add an option for custom CSS #228

Closed
Djiit opened this issue Dec 23, 2015 · 7 comments
Closed

Add an option for custom CSS #228

Djiit opened this issue Dec 23, 2015 · 7 comments

Comments

@Djiit
Copy link

Djiit commented Dec 23, 2015

It would be great to have an option to allow custom CSS to be applied on the webpage by phantomJS before rendering the screenshot. Do you plan to add this feature in the future ?

Thx

@kevva
Copy link
Contributor

kevva commented Jan 8, 2016

We might as well expose the whole page object itself and let the user do whatever. Thoughts @sindresorhus?

@sindresorhus
Copy link
Owner

@kevva 👎 Then the user is free to change and break anything and will complain to us when it breaks what we do. I'd rather have defined and controlled ways to do this.

@kevva
Copy link
Contributor

kevva commented Jan 8, 2016

That's the downside of the flexibility that'd give, yeah. I'll add an option for this then.

@SamVerschueren
Copy link
Contributor

How should the API look like for this feature? Would it accept raw css, or a file?

const pageres = new Pageres({delay: 2})
    .src('yeoman.io', ['480x320', '1024x768', 'iphone 5s'], {crop: true})
    .css('custom.css')
    .dest(__dirname)
    .run()
    .then(() => console.log('done'));
const pageres = new Pageres({delay: 2})
    .src('yeoman.io', ['480x320', '1024x768', 'iphone 5s'], {crop: true})
    .css('body { display: none }')
    .dest(__dirname)
    .run()
    .then(() => console.log('done'));

@Djiit
Copy link
Author

Djiit commented Jan 29, 2016

FWIW, the raw css options would be suficient for my personal intended use.

@SamVerschueren
Copy link
Contributor

Actually, it would be pretty easy to check if the argument provided is a file or not so we can support both. I can imagine that if you really want to add a lot of custom css stuff, you would rather prefer a separate file instead of embedding the css.

@Djiit
Copy link
Author

Djiit commented Feb 6, 2016

I really appreciate the effort guys. Thanks a lot !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants