├── LICENCE ├── README.md └── webflow-bootstrap.js /LICENCE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Samuel Liew 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the 'Software'), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 6 | 7 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 8 | 9 | THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # webflow-bootstrap 2 | 3 | [![License](http://img.shields.io/badge/License-MIT-blue.svg)](http://opensource.org/licenses/MIT) 4 | 5 | 6 | ## About 7 | 8 | Simple way to convert a Webflow site with Webflow components into a Bootstrap-themed website. 9 | 10 | **Do you:** 11 | 12 | - prefer Bootstrap's default design over Webflow? 13 | - just want to quickly launch a minimal site without worrying much about styling individual components 14 | - want a 1140px-width Bootstrap container / or dislike the default 940px max-width Webflow container? 15 | - find it difficult to use dropdowns in the Webflow navbar? 16 | - etc... 17 | 18 | 19 | ## Demo 20 | 21 | _Compare how your site could look before and after using this_ 22 | 23 | **Before:** [http://webflow-bootstrap-before.webflow.io](http://webflow-bootstrap-before.webflow.io) 24 | **After:** [http://webflow-bootstrap.webflow.io](http://webflow-bootstrap.webflow.io) 25 | 26 | 27 | ## Instructions 28 | 29 | 1. Use the instructions on [this forum thread](https://forum.webflow.com/t/how-to-embed-files-hosted-on-github/29281?u=samliew) to insert the script file [webflow-bootstrap.js](https://github.com/samliew/webflow-bootstrap/blob/master/webflow-bootstrap.js), into your project's *Site Settings > Footer Code*. 30 | It should be as simple as this: 31 | `` 32 | 33 | 2. Save and publish. 34 | 35 | 36 | ## Support 37 | 38 | Please use the [issue tracker](https://github.com/samliew/webflow-bootstrap). Pull-requests welcome. -------------------------------------------------------------------------------- /webflow-bootstrap.js: -------------------------------------------------------------------------------- 1 | /** 2 | * webflow-bootstrap - Webflow to Bootstrap convertor 3 | * 4 | * @author Samuel Liew 5 | * @license MIT license 6 | * @version 1.0.0 7 | * @link https://github.com/samliew/webflow-bootstrap 8 | */ 9 | 10 | /* global jQuery, $ */ 11 | 12 | var Webflow = Webflow || []; 13 | Webflow.push(function() { 14 | 15 | // Helper functions 16 | function randNum() { return Math.floor(Math.random() * 999999) + 100000 }; 17 | 18 | // Load Bootstrap stylesheet 19 | $('').appendTo('head').attr({ type:'text/css', rel:'stylesheet', href:'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css'}); 20 | 21 | // Convert Typography & Content 22 | $('.w-container').addClass('container').removeClass('w-container'); 23 | $('blockquote').addClass('blockquote'); 24 | $('table').addClass('table'); 25 | $('.w-richtext-figure-type-image').addClass('figure').each(function() { 26 | $(this).find('img').addClass('figure-img img-fluid'); 27 | $(this).find('figcaption').addClass('figure-caption').css('margin', 'auto'); 28 | }); 29 | 30 | // Convert Navigation 31 | $('.w-nav').each(function() { 32 | var navToggleId = 'navtt-' + randNum(); 33 | $(this).children('.container').children().first().unwrap(); 34 | $(this).find('.w-nav-brand').addClass('navbar-brand').removeClass('w-nav-brand'); 35 | $(this).find('.w-nav-button').off().after('