Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Webpack loader that directly exports the source of whatever file it's passed

License

Notifications You must be signed in to change notification settings

static-dev/source-loader

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Webpack Source Loader

npm tests dependencies coverage

Webpack loader that exports the source directly

Note: This project is in early development, and versioning is a little different. Read this for more details.

Why should you care?

If you need to load up a file's source directly and have it available within your javascript, this loader is what you're after. For example, you could load up a svg file, parse out a path you want, and manipulate that with your javascript somehow. Or you could load up a json or text file. Or some other type of file that you came up with yourself. Whatever it is, as long as it's contents would be ok after being run through JSON.stringify (read: text files, not images or binary files), it will work just great with the source loader.

Installation

npm install source-loader -S

Usage

Just load it up in your webpack config like this:

module.exports = {
  module: {
    loaders: [
      { test: /\.foo$/, loader: 'source' }
    ]
  }
}

Then you can require it up in your main entry:

const fooFile = require('testing.foo')
console.log(fooFile) // wow it's the contents!

License & Contributing

About

Webpack loader that directly exports the source of whatever file it's passed

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •