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

Unable to configure Jade options #2614

Closed
jaydenseric opened this issue Apr 13, 2016 · 9 comments
Closed

Unable to configure Jade options #2614

jaydenseric opened this issue Apr 13, 2016 · 9 comments

Comments

@jaydenseric
Copy link

I need to disable the Jade pretty option in both development and production so HTML is minified, to avoid whitespace issues when display: inline-block components are looped next to each other.

Looking at the way Keystone renders the views here, this should at least happen if you set the node env to production. I tried this to no effect.

Regardless, I would like to be able to configure Jade for development.

Is there a workaround in the meantime?

@mxstbr
Copy link
Collaborator

mxstbr commented Apr 29, 2016

We're closing all questions and support requests to keep the issue tracker unpolluted. Please ask this question on Stackoverflow or Gitter instead!

@mxstbr mxstbr closed this as completed Apr 29, 2016
@jaydenseric
Copy link
Author

This really is an issue. There is no way to configure Jade in Keystone and quality suffers. Having uncompressed HTML in development and compressed production prevents certain layout techniques and causes surprising layout bugs moving between development and production.

.tile {
  display: inline-block;
  width: 50%;
}
<div>
  <div class="tile">Foo</div>
  <div class="tile">Foo</div>
</div>

Renders the tiles in 2 rows.

<div><div class="tile">Foo</div><div class="tile">Foo</div></div>

Displays tiles in 2 columns.

Ideally, Jade alway runs without --pretty and you opt in to it if desired.

@JedWatson
Copy link
Member

Wow, that is genuinely surprising. I was under the impression that whitespace (not spaces between elements but newline+tabs) were ignored by browsers.

We're prepping an 0.3 patch release, I'll see what can be done to open those options up for you.

@JedWatson JedWatson reopened this Jun 3, 2016
@jaydenseric
Copy link
Author

Relevent: pugjs/pug#1833 (comment)

@arthcmr
Copy link

arthcmr commented Jun 13, 2016

+1

@arthcmr
Copy link

arthcmr commented Jun 13, 2016

@jaydenseric
Copy link
Author

In the meantime, for others stuck, and not a permanent fix/solution:

response.locals.pretty = false

Inside route middleware seems to force Jade to ignore earlier config and render minified HTML.

@JedWatson
Copy link
Member

@arthurcamara1 that's actually only having an impact on the Admin UI which isn't relevant to this issue; the problem here is being able to configure pretty in the default express locals

@JedWatson
Copy link
Member

I've made it so you can now specify pretty in the locals setting, and it won't be overridden which fixes this issue! Also published a new patch with the change in it (0.3.21) since I didn't get a chance to add this in the last release.

trongthanh added a commit to naustudio/keystone that referenced this issue Jan 16, 2018
…am/v0.3.x into release/two-language-main-vi

* commit 'c38b366c7b1bf01448c8ece7c36e1bb6eb195186': (63 commits)
  fixes Cloudinary select fields break other Relationship fields when using select: true (keystonejs#3848)
  Don't cache relationship options
  fix linter errors, I'm a little OCD
  implement fix to determine whether input param is string or object and act accordingly to set q  value
  Fix keystonejs#3207
  Removing hardcoded keystone references in the API
  0.3.22
  Update CHANGELOG
  Fix relationship inital display
  Allow local connections without forcing SSL
  Let's Encrypt support
  Fix to prevent the use of regex matching when applying an "exact" filter through the Keystone admin ui
  Convert req strings to number where needed
  keystonejs#3011 | Fix Date format option bug
  v0.3.21
  Updating changelog
  Only setting pretty local when it is undefined, ref keystonejs#2614
  v0.3.20
  Updating changelog
  keystonejs#3030 | fix Date unit tests
  ...

# Conflicts:
#	fields/types/boolean/BooleanField.js
#	index.js
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

4 participants