1.2.0 • Published 4 years ago

karma-sprockets-mincer v1.2.0

Weekly downloads
11,535
License
MIT
Repository
github
Last release
4 years ago

karma-sprockets-mincer

Serve assets developed for Sprockets with Mincer

Installation

Add karma-sprockets-mincer as a devDependency in your package.json.

{
  "devDependencies": {
    "karma": "",
    "karma-sprockets-mincer": ""
  }
}

or

npm install karma-sprockets-mincer --save-dev

Configuration

Add the plugin to your config file.

  plugins: [
    'karma-phantomjs-launcher'
    [...]
    'karma-sprockets-mincer'
  ]

Then add sprockets-mincer to the top of the frameworks list (order is important).

frameworks: [
  "sprockets-mincer"
  "jasmine"
]

Next, configure the paths that the Sprockets (Mincer) environment should know about.

sprocketsPaths: [
  'app/assets/javascripts'
  'lib/assets/javascripts'
  'vendor/assets/javascripts'
]

Then, configure the js bundle files that Sprockets should generate. These files will be regenerated whenever a sprockets environment file changes.

sprocketsBundles: [
  'application.coffee'
]

Be sure to also add files listed in sprocketsBundles to config.files in the correct place. sprockets-mincer will replace the pattern in config.files with the one that is compiled.

files: [
  ...
  'application.coffee' # this pattern will be replaced automatically
  ...
]

Helpers

You can add helpers that the assets might be using:

sprocketsHelpers:
  asset_path: (fileName) -> return "assets/#{fileName}"

RubyGems

If you are using this in a Ruby/Rails project, you can add the rubygem paths as well:

# "gem-name": ["array of", "sprockets paths"]
rubygems: {
  "rails-widget": ["lib/assets/javascripts", "vendor/assets/javascripts"]
  "jquery-rails": ["vendor/assets/javascripts"]
}

This will run grab the path of the bundled gem by running bundle info --path and add them with the specified paths to Sprockets/Mincer.

Additional Mincer engines

The path to engine file can be both absolute or relative to basePath.

# "extension": "path-to-engine-definition-file.js"
mincerEngines: {
  ".hbs": "./lib/handlebarsjst.js",
  ".xxx": "/opt/mincer-ext/engine.js"
}
1.2.0

4 years ago

1.1.4

4 years ago

1.1.3

4 years ago

1.1.2

4 years ago

1.1.1

7 years ago

1.1.0

8 years ago

1.0.0

8 years ago

0.3.0

8 years ago

0.2.0

8 years ago

0.1.5

9 years ago

0.1.4

9 years ago

0.1.3

9 years ago

0.1.2

9 years ago

0.1.1

9 years ago

0.1.0

9 years ago

0.0.9

9 years ago

0.0.8

10 years ago

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago