Skip to content

Instantly share code, notes, and snippets.

@davidguttman
Last active February 29, 2024 21:43
  • Star 25 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save davidguttman/1f61ab59349cb99d28a1 to your computer and use it in GitHub Desktop.
Bootstrap and Browserify
// Bootstrap wants jQuery global =(
window.jQuery = $ = require('jquery')
// Bootstrap doesn't have a "main" field / export anything =(
var bootstrap = require('bootstrap/dist/js/bootstrap')
// Get Bootstrap styles with cssify
var style = require('./node_modules/bootstrap/dist/css/bootstrap.css')
var popover = document.createElement('span')
popover.innerHTML = 'I have a popover'
document.body.appendChild(popover)
$(popover).popover({ content: 'I am popover text' })
{
"name": "bfy-bootstrap-test",
"version": "0.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "beefy index.js --live"
},
"author": "David Guttman <david@guttman.io> (http://davidguttman.com/)",
"license": "MIT",
"dependencies": {
"beefy": "^2.1.1",
"bootstrap": "^3.2.0",
"browserify": "^5.10.0",
"cssify": "^0.6.0",
"jquery": "^2.1.1"
},
"browserify": {
"transform": [
"cssify"
]
}
}
@ldong
Copy link

ldong commented Aug 16, 2015

This works for me. Thanks.

@fmagrosoto
Copy link

Excelent... thanks!!

@peterbarraud
Copy link

Does anybody get this error:

Cannot find module 'rijs.resdir'

@peterbarraud
Copy link

Sorry guys please ignore the question. Problemo fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment