Last active
February 29, 2024 21:43
-
-
Save davidguttman/1f61ab59349cb99d28a1 to your computer and use it in GitHub Desktop.
Bootstrap and Browserify
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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' }) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "bfy-bootstrap-test", | |
"version": "0.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"start": "beefy index.js --live" | |
}, | |
"author": "David Guttman <[email protected]> (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" | |
] | |
} | |
} |
Excelent... thanks!!
Does anybody get this error:
Cannot find module 'rijs.resdir'
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
This works for me. Thanks.