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

File xxx.css failed. net::ERR_ABORTED at file xxx.php #52

Open
Minirock opened this issue Aug 9, 2018 · 8 comments
Open

File xxx.css failed. net::ERR_ABORTED at file xxx.php #52

Minirock opened this issue Aug 9, 2018 · 8 comments

Comments

@Minirock
Copy link

Minirock commented Aug 9, 2018

I have a question that might be related to an issue I have.

I try to use it for the first time: so here is what I did in my gruntfile.

module.exports = function(grunt) {

  grunt.loadNpmTasks('grunt-critical');

  grunt.initConfig({
    pkg: grunt.file.readJSON('package.json'),
    critical: {
      test: {
          options: {
              base: './',
              css: [
                  'assets/css/frontend/accueil.css',
                  'lib/bootstrap/css/bootstrap.css'
              ],
              width: 320,
              height: 70
          },
          src: 'apps/frontend/modules/accueil/template.php',
          dest: 'apps/frontend/modules/accueil/template.css'
      }
    }
  });
  grunt.registerTask('default', ['critical']);
};

So if I understand what I'm doing: the task will look the critical css from the file template.php coming from accueil.css and bootstrap.css and will write the new css inside template.css. Am I right ?

But actually I'm getting this error and I can't find why:

Running "critical:test" (critical) task
>> File "apps/frontend/modules/accueil/template.css" failed. net::ERR_ABORTED at file:///var/www/html/critical.agoravita.com/temp/test-critical/apps/frontend/modules/accueil/template.php
Warning: File "apps/frontend/modules/accueil/template.css" failed. Use --force to continue.

Aborted due to warnings.

I would also like to know how is it working exactly ? When I look to your example you are using an html page. But can work with php page too ? I guess it is. But then, what if the php page is using multiple template. In fact my file template.php is a bunch of functions that might be called or not.

@bezoerb
Copy link
Owner

bezoerb commented Aug 12, 2018

So if I understand what I'm doing: the task will look the critical css from the file template.php coming from accueil.css and bootstrap.css and will write the new css inside template.css. Am I right ?

You're right. Apart the fact that critical can't interpret php itself so you need to use an url where the page can be fetched. See the test-remote-css example.

@Minirock
Copy link
Author

Thanks for your response,

In your example I can see the src file is still an html one.

Indeed I saw server language are not working so I tried to use an url such as http://website/accueil (this page should be the resulting html of accueil.php with the css).
But, even if I didn't get any errors, I've got no css generated neither. So I've come to think that even with an online url It can't work.

I might have missed something.

@bezoerb
Copy link
Owner

bezoerb commented Aug 12, 2018

An online url should work without problems. Can you check the output of critical cli for your url?

npm i -g critical
critical http://website/accueil

@Minirock
Copy link
Author

I guess I'm still missing something in configs; but chromium is installed.

grunt critical
Running "critical:test" (critical) task

File "test_fichier/resultat.css" failed. Penthouse timed out after 30s.
Warning: File "test_fichier/resultat.css" failed. Use --force to continue.

Aborted due to warnings.

========================================================

critical https://critical.agoravita.com/temp/test-critical/
Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
at assert (/usr/local/lib/node_modules/critical/node_modules/puppeteer/lib/helper.js:282:11)
at Function.launch (/usr/local/lib/node_modules/critical/node_modules/puppeteer/lib/Launcher.js:106:7)

@bezoerb
Copy link
Owner

bezoerb commented Aug 13, 2018

which node/npm version do you have installed?

@Minirock
Copy link
Author

node -v
v10.8.0

npm -v
6.2.0

@bezoerb
Copy link
Owner

bezoerb commented Aug 21, 2018

Your last comment looks like chromium isn't installed at all.

Error: Chromium revision is not downloaded. Run "npm install" or "yarn install"
at assert (/usr/local/lib/node_modules/critical/node_modules/puppeteer/lib/helper.js:282:11)
at Function.launch (/usr/local/lib/node_modules/critical/node_modules/puppeteer/lib/Launcher.js:106:7)

What's happening if you run
npx critical https://critical.agoravita.com/temp/test-critical/

I'm getting expected results for that so maybe that's not a problem with critical

@bezoerb
Copy link
Owner

bezoerb commented Aug 23, 2018

I just had a simmilar issue where puppeteer did not install correctly.
rm -Rf node_modules && yarn resolved it for me.

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

No branches or pull requests

2 participants