Skip to content
GitLab
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !13824

Allow npm package to be resolved via node module resolution

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Administrator requested to merge github/fork/jsdf/node-requirable into master Jun 15, 2014
  • Overview 0
  • Commits 9
  • Pipelines 0
  • Changes 4

Created by: jsdf

Bootstrap currently publishes an npm package but as there is no index.js or main field in the package.json, even if it is installed via npm it can't be resolved by require.resolve().

This would be useful when using Bootstrap in projects with a node-based build system (grunt, gulp, etc). For example, something like:

var path = require('path')

// using require.resolve
var bootstrapPath = path.dirname(require.resolve('bootstrap'))
// alternatively, just using require, as index.js exports __dirname
var bootstrapPath = require('bootstrap')

// compile some less with bootstrap in the import paths
require('less').render(someLessData, {paths: [bootstrapPath + '/less']} , function(err, data) {
...
})
Assignee
Assign to
Reviewers
Request review from
Time tracking
Source branch: github/fork/jsdf/node-requirable