I am working on a project that is currently using bootstrap. However, this was done by loading the boot files into a subdirectory. I would like to move on to using npm, as this will greatly facilitate the upgrade.
In our existing style folder there is bootstrap and source as subfolders + index.js file:
var ms = require('ms'); var join = require('path').join; var less = require('transform')('less'); var express = require('express'); var app = express(); .............*other code* app.get('/bootstrap.css', less(join(__dirname, 'source', process.env.COMPANY_ID + '-root.less'))); app.get('/print.css', less(join(__dirname, 'source', process.env.COMPANY_ID + '-print.less'))); module.exports = app;
In the source folder, we have several .less files, including company-root.less , which imports various smaller files:
@import "./bootstrap/bootstrap.less"; @import "./variables/all.less"; @import "./variables/company.less"; @import "./customcss.less"; @import "./subnav.less"; @import "./nav-list.less";
I added bootstrap to package.json and ran npm install , so I have bootstrap in the node_modules folder, but cannot make the project work with new files. I tried to put
var $ = require('jQuery'); global.jQuery = $; require('bootstrap');
in index.js This gives me an error:
TypeError: Cannot set property 'emulateTransitionEnd' of undefined at C:\Users\Dee\Documents\GitHub\MAPS\node_modules\bootstrap\js\transition.js:36:29
I tried changing the first line of company-root.js to:
@import (npm) "bootstrap";
OR
@import "../../node_modules/bootstrap/less/bootstrap.less";
but it just does not lead to formatting.
I spent three hours etching the net, but made no progress. Can anybody help me?