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

URL for easy re-download of same custom options #1487

Closed
ljharb opened this issue Feb 1, 2012 · 17 comments
Closed

URL for easy re-download of same custom options #1487

ljharb opened this issue Feb 1, 2012 · 17 comments
Labels

Comments

@ljharb
Copy link

ljharb commented Feb 1, 2012

When I've gone through and clicked my custom set of checkboxes, and entered my custom set of CSS values, what happens when I want to update to Bootstrap 2.0.1, or if I want to redownload it because I lost the original?

What I'd like is a URL, ideally embedded in the downloaded zip as well as displayed on the webpage, that pre-selects and pre-enters the same values.

What I'm thinking for implementation is, use some reversible hashing algorithm on $('form').serialize() - maybe gzip with zip.js or something - and add that on the URL with a query param (not as part of the URL fragment, please). Then, even better, allow me to pass that query param directly to a download link so I can wget (as part of a build script or something) the updated zip file!

@ljharb
Copy link
Author

ljharb commented Feb 1, 2012

I suppose the reversible hashing thing just makes the URLs shorter - I guess you could just make a super-long URL with all the options exposed as well, so then you could manually hack the URL.

@cstuder
Copy link
Contributor

cstuder commented Feb 1, 2012

The jQuery UI Themeroller (http://jqueryui.com/themeroller/) could serve as an inspiration: It stores all settings as string parameters into the hash part of the URL and writes that URL into the generated CSS itself. This way, you can restore all the chosen settings with one click.

@ljharb
Copy link
Author

ljharb commented Feb 1, 2012

For so many reasons, not the least of which is that you could curl without needing JS support, it would be preferable if this was a query param and NOT in the hash part of the URL.

@ghost ghost assigned ljharb May 30, 2012
@twentyfortysix
Copy link

or, another solution might be, what I wrote in here:
#3658 (comment)

"
...What I do is that I write the variables in to my own CSS as comment like this:
@textcolor #000
@linkColor #000
@linkColorHover #333
@sansFontFamily Nimbus, Tahoma
....

Without this memo I won't be able to go back and generate my customized bootstrap again.

My suggestion is to have a input box on the page http://twitter.github.com/bootstrap/download.html
where we can place this memo which will refill the variables.

I think the format can be simple as each variable per line, like the example above.
"
.. and even better the customizer could append these values in the bootstrap.css description (head) part in the desired format, so we can copy & paste them back to the customizer.

@ljharb
Copy link
Author

ljharb commented Jun 1, 2012

I'm working on this - and I think a single URL would be the easiest, and would enable command-line updating as well. There's also more options than just the CSS variables.

@mckramer
Copy link
Contributor

@ljharb, have you taken a look at how the customizations are currently being passed to the herokuapp for building? Line 122-148 in application.js. Seems like that would be a great place to import/export the vars.

For instance, I might be posting:

js:["bootstrap-transition.js","bootstrap-modal.js","bootstrap-dropdown.js","bootstrap-scrollspy.js","bootstrap-tab.js","bootstrap-tooltip.js"]
css:["reset.less","scaffolding.less","grid.less","layouts.less","type.less","code.less","labels-badges.less","tables.less","modals.less","dropdowns.less","accordion.less","carousel.less","wells.less","close.less","utilities.less","component-animations.less","responsive-utilities.less","responsive-767px-max.less","responsive-768px-979px.less","responsive-1200px-min.less","responsive-navbar.less"]
vars:{"@bodyBackground":"@white"}
img:["glyphicons-halflings.png","glyphicons-halflings-white.png"]

I like the idea of using the URL-based, for the purpose of command-line updates.

@apuravchauhan
Copy link

i have rolled out an app that takes care of the reload feature and provides a visual interface to see the customized theme in real time.
http://www.bootstrapthemeroller.com
It saves all the settings in the url just like jquery themeroller. Just use this url to reload all the styles whenever u want.

Let me know if i could help and contribute to the boostrap community in any other way.

@cstuder
Copy link
Contributor

cstuder commented Jul 2, 2012

@apuravchauhan That's a great site. One feature request though: If I forget to bookmark the URL, I have to redo the whole theme. The jQuery themebuilder actually writes the URL into the CSS file it generates, so the settings are always kept with the custom theme.

@ljharb
Copy link
Author

ljharb commented Jul 2, 2012

My plan is indeed to include the URL in the file, and work on it is in progress.

@apuravchauhan
Copy link

@ljharb Can you build this in an api way so that other clients could also use twitter's customization server for downloads.

Before sending out the zip file, this server would actually look for a variable in the request and if that is set it will write that url in the file.

For example:
Site XYZ is using herokuappserver to get its download by sending the request. Now your node server will look for a variable lets say "downloadUrl:'http://xyz.com/#@textColor=red'". Then it will write that else it will fall back to the usual twitter's download url.

Advantage: Other clients could use the advantage of this open source for building more apps over this server.

@jazbek
Copy link

jazbek commented Aug 9, 2012

@ljharb this is awesome, but is there some reason why all of the options aren't available? for example, right off the bat i see that the grid system options aren't on here anywhere (i.e. @gridColumns, @gridColumnWidth, etc). not sure if there are other options missing also.

@mdo
Copy link
Member

mdo commented Feb 8, 2013

I've closed all customizer issues here in favor of tracking in the #6342 pull request, but this one should be handled in the bootstrap-server repo as the references commits show.

@mdo mdo closed this as completed Feb 8, 2013
@shuttj
Copy link

shuttj commented Jan 9, 2014

Was this ability ever added? If so, I can't seem to find the reference on how to do it.

@cvrebert
Copy link
Collaborator

cvrebert commented Jan 9, 2014

@shuttj: #9951. However, when you click the "Compile and Download" button, the browser URL changes (to e.g. http://getbootstrap.com/customize/?id=7258922); visiting the URL again will reload the same settings.
Additionally, the settings & variables are now dumped to a config.json file that's included in the ZIP file.

@shuttj
Copy link

shuttj commented Jan 9, 2014

@cvrebert Thanks! Is there a way I can take it a step further and simulate clicking the "Compile and Download" button in a script to download the generated zip?

@cvrebert
Copy link
Collaborator

cvrebert commented Jan 9, 2014

@shuttj If you're already using a build script, you might as well just build Bootstrap using Grunt.

@shuttj
Copy link

shuttj commented Jan 10, 2014

@cvrebert Grunt is nice and all, but that means I need to have Grunt (and everything required to run it) installed on all my development boxes and integration servers. It really would be nice to have an API to request a custom build from. Oh well, thanks for your help.

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

No branches or pull requests

9 participants