flovilmart / parse-anywhere

A local parse environment
103 stars 17 forks source link

Loading generated html into css and js files locally #14

Open toddheslin opened 10 years ago

toddheslin commented 10 years ago

I've just found parse-develop and absolutely loving it however with a new app I've set up I have my local css and js files populated with the generated html that comes from the jade output. (Using jade not EJS) These files do have content in them in my editor and they are being saved properly but this content is overwritten by the generated css when I inspect the browser.

Have you seen this before? It only happens on one app and not another but they have almost an identical setup and nothing too funky that should cause any difference.

Thanks for your help.

flovilmart commented 10 years ago

Hi Todd,

Without the code, that will be hard for me to understand your problem. 

May be it's a caching problem?

Could you attach screenshots, of what you have, what you'd expect etc...

On Sun, Nov 2, 2014 at 12:06 PM, Todd Heslin notifications@github.com wrote:

I've just found parse-develop and absolutely loving it however with a new app I've set up I have my local css and js files populated with the generated html that comes from the jade output. (Using jade not EJS) These files do have content in them in my editor and they are being saved properly but this content is overwritten by the generated css when I inspect the browser. Have you seen this before? It only happens on one app and not another but they have almost an identical setup and nothing too funky that should cause any difference.

Thanks for your help.

Reply to this email directly or view it on GitHub: https://github.com/flovilmart/parse-develop/issues/14

toddheslin commented 10 years ago

Sorry Florent, I should have included those.

Here is what is generated for local css and js files (including my own and bootstrap) when deploying locally with parse-develop: https://www.dropbox.com/s/2ltj1oi2gp02chf/Screenshot%202014-11-02%2018.49.36.png?dl=0

And then when I deploy this to Parse I get it correctly: https://www.dropbox.com/s/81xsuyg9n9kf3te/Screenshot%202014-11-02%2018.51.34.png?dl=0

My layout base jade file looks like this (you'll see that I had to revert back to the bootstrap CDN for it to deploy locally) https://www.dropbox.com/s/eyepydru0ku4u39/Screenshot%202014-11-02%2018.52.10.png?dl=0

flovilmart commented 10 years ago

Il looks like you layout is getting called while you try to render your css file.

Is your style.css actually a jade file that your render or a static css?

On Sun, Nov 2, 2014 at 12:52 PM, Todd Heslin notifications@github.com wrote:

Sorry Florent, I should have included those. Here is what is generated for local css and js files (including my own and bootstrap) when deploying locally with parse-develop: https://www.dropbox.com/s/2ltj1oi2gp02chf/Screenshot%202014-11-02%2018.49.36.png?dl=0 And then when I deploy this to Parse I get it correctly: https://www.dropbox.com/s/81xsuyg9n9kf3te/Screenshot%202014-11-02%2018.51.34.png?dl=0 My layout base jade file looks like this (you'll see that I had to revert back to the bootstrap CDN for it to deploy locally)

https://www.dropbox.com/s/eyepydru0ku4u39/Screenshot%202014-11-02%2018.52.10.png?dl=0

Reply to this email directly or view it on GitHub: https://github.com/flovilmart/parse-develop/issues/14#issuecomment-61416145

toddheslin commented 10 years ago

This one is a static css file. I've tried a few different options with the configuration of the layout.css file to see if it was a jade-specific error with tabs/spaces (I've come across this before) but it seems to be okay.

flovilmart commented 10 years ago

So it appears that this CSS file gets processed by the layout engine with your html template, am I right?

On Sun, Nov 2, 2014 at 1:07 PM, Todd Heslin notifications@github.com wrote:

This one is a static css file. I've tried a few different options with the configuration of the layout.css file to see if it was a jade-specific error with tabs/spaces (I've come across this before) but it seems to be okay.

Reply to this email directly or view it on GitHub: https://github.com/flovilmart/parse-develop/issues/14#issuecomment-61416676

toddheslin commented 10 years ago

Yes correct. The CSS file is linked in layout.jade which is extended by any page jade markup that is called within app.get(.....)

flovilmart commented 10 years ago

No I mean the result you have locally, for style.css.

It looks like the layout.jade is being rendered instead of just rendering the CSS.

On Sun, Nov 2, 2014 at 1:18 PM, Todd Heslin notifications@github.com wrote:

Yes correct. The CSS file is linked in layout.jade which is extended by any page jade markup that is called within app.get(.....)

Reply to this email directly or view it on GitHub: https://github.com/flovilmart/parse-develop/issues/14#issuecomment-61417115

toddheslin commented 10 years ago

Ah yes, sorry I misunderstood. It actually loads the layout.jade + the actual page that was loaded. i.e. it renders the full html of the page

flovilmart commented 10 years ago

Is the style.css in the public folder or in a template one?

You may need to switch the layout off for that path. Odd thing is thAt the parse servers don't render it as a template

On Sun, Nov 2, 2014 at 1:39 PM, Todd Heslin notifications@github.com wrote:

Ah yes, sorry I misunderstood. It actually loads the layout.jade + the actual page that was loaded. i.e. it renders the full html of the page

Reply to this email directly or view it on GitHub: https://github.com/flovilmart/parse-develop/issues/14#issuecomment-61417890

toddheslin commented 10 years ago

The style.css is in the public folder. This setup seems to work for multiple other projects on the parse servers and I've checked another project using parse-develop locally and it's fine. It's totally got me beat.

toddheslin commented 10 years ago

Okay so I found where it's tripping up. Hopefully this might identify something different between parse-develop and loading on the parse servers.

It's actually an app.get function within app.js that looks like this:

app.get('/:lingo/:means', function(req, res) {
  res.locals.title = "What I mean is...";
  res.render('app', {   
    lingoWord: req.params.lingo,
    actuallyMeans: req.params.means
  });
});

Note that this works fine:

app.get('/:lingo', function(req, res) {
  res.locals.title = "What I mean is...";
  res.render('app', {   
    lingoWord: req.params.lingo,
    actuallyMeans: ' '
  });
});

I'm pretty sure the syntax is right because it works fine on the Parse servers. Any idea what could be tripping it up locally?

flovilmart commented 10 years ago

I tend to belive your fonction that takes two parameters will override express into looking for the public/style.css

If you remove that call will it render the css properly?

On Sun, Nov 2, 2014 at 4:46 PM, Todd Heslin notifications@github.com wrote:

Okay so I found where it's tripping up. Hopefully this might identify something different between parse-develop and loading on the parse servers. It's actually an app.get function within app.js that looks like this:

app.get('/:lingo/:means', function(req, res) {
  res.locals.title = "What I mean is...";
  res.render('app', { 
      lingoWord: req.params.lingo,
      actuallyMeans: req.params.means
  });
});

Note that this works fine:

app.get('/:lingo', function(req, res) {
  res.locals.title = "What I mean is...";
  res.render('app', { 
      lingoWord: req.params.lingo,
      actuallyMeans: ' '
  });
});

I'm pretty sure the syntax is right because it works fine on the Parse servers. Any idea what could be tripping it up locally?

Reply to this email directly or view it on GitHub: https://github.com/flovilmart/parse-develop/issues/14#issuecomment-61425230

toddheslin commented 10 years ago

Sorry Florent, which function are you referring to? In my example, both functions are identical except for the expression '/:lingo/:means' and '/:lingo' which should only be what URL it is looking for.

What has me stumped is that it works fine on the Parse servers, just not locally.

I'm happy to debug this with you because It could affect other people using the Parse-develop library.

flovilmart commented 10 years ago

I encourage you to submit a pull request if you find and the bug in the server :) Could you push me your code / dummy project that reproduce/test case on a repo so I'll be faster to find the source of the error and reproduce it?

On Wed, Nov 5, 2014 at 5:51 PM, Todd Heslin notifications@github.com wrote:

Sorry Florent, which function are you referring to? In my example, both functions are identical except for the expression '/:lingo/:means' and '/:lingo' which should only be what URL it is looking for. What has me stumped is that it works fine on the Parse servers, just not locally.

I'm happy to debug this with you because It could affect other people using the Parse-develop library.

Reply to this email directly or view it on GitHub: https://github.com/flovilmart/parse-develop/issues/14#issuecomment-61896586

toddheslin commented 10 years ago

@flovilmart Added you to the repo :)