question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

How to use `npm.static` config

See original GitHub issue

Description

I would like fonts from an npm package to be copied over to my public directory. there is an npm.static configuration option in https://github.com/brunch/brunch/blob/master/docs/config.md but there’s hardly anything about it and I could not figure out how to use it at all.

could I get an example how to go about using this / maybe put that explanation in the documentation as well?

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:1
  • Comments:8 (6 by maintainers)

github_iconTop GitHub Comments

6reactions
sammecommented, Jan 31, 2017

NB npm.static values must start with node_modules/, not just the module name.

2reactions
lydellcommented, Apr 12, 2016

I thought npm.assets would copy over any files too. Thanks for clarifying. I think the docs should be updated to say the option is all/only about JavaScript.

Incidentally, I was also trying to use fonts from an npm package. I added the following at the bottom of my brunch-config.js. Seems to be working so far.

const recurFs = require('recur-fs') // npm install recur-fs

recurFs.cp(
  'node_modules/font-awesome/fonts/',
  'public/font-awesome',
  false, // Don’t overwrite.
  (error) => {
    if (error) {
      console.error('Failed to copy font-awesome fonts', error)
    }
  }
)

(In case somebody searches for “font-awesome” and ends up here: I also use the following:

$fa-font-path: 'font-awesome';

@import 'node_modules/font-awesome/scss/font-awesome';

)

Read more comments on GitHub >

github_iconTop Results From Across the Web

static-config - npm
Start using static-config in your project by running `npm i static-config`. There is 1 other project in the npm registry using ...
Read more >
Serving Static Resources in Node.js - TutorialsTeacher
First of all, install node-static module using NPM as below. npm install node-static. After installing node-static module, you can create static file server...
Read more >
npm.Static.config JavaScript and Node.js code examples
Most used npm functions · Config.config · Config.get · Static.config · Static.on · Static.prefix · mockImplementation · mockReset ...
Read more >
How to build a static website without frameworks using npm ...
This will check your CSS files in the dist directory and add the prefixes for them. So you need to run npm run...
Read more >
How to build the static file for use in deployment - Stack Overflow
How can I configure my webpack.js files and package.json command to make it build the required bundle file ? When I run npm...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found