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 best handle static (e.g. _locales) files

See original GitHub issue

Great project! 👍

I was wondering how to best handle static files that are not referenced anywhere.

E.g. the _locales folder. Currently I use a package.json subtask to specifically copy over some files to the build directory.

Parcel doesn’t seem to support that currently: https://github.com/parcel-bundler/parcel/issues/1411

What’s your take on this, how would you handle e.g. _locales files currently? 😃

Best

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
berstendcommented, Jul 8, 2018

Agreed, seems like _locales is the only case where such specific workaround is required - would be great to support this as it’s quite commonly used.

Unfortunately I have to finish a project right now, otherwise I’d give the implementation a shot 😃

For now my workaround using npm scripts works sufficiently (using cpx):

{
  "scripts": {
    "build": "export NODE_ENV=development && yarn run build:clean && yarn run locales:copy && parcel build --no-minify src/manifest.json -d build/${NODE_ENV}/",
    "build:production": "export NODE_ENV=production && yarn run build:clean && yarn run locales:copy && parcel build --no-source-maps --no-cache src/manifest.json -d build/${NODE_ENV}/",
    "build:clean": "rimraf build/${NODE_ENV}/",
    "watch": "export NODE_ENV=development && yarn run build:clean && yarn run locales:copy && parcel watch src/manifest.json -d build/${NODE_ENV}/",
    "locales:copy": "cpx 'src/_locales/**/*.json' build/${NODE_ENV}/_locales/",
  }
}

I really like the project so I’ll definitely plan to contribute in the future. 😃

1reaction
kevincharmcommented, Jul 16, 2018

No worries, thanks a lot for testing it @berstend 😃 Released with v1.3.1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to manage static files (e.g. images, JavaScript, CSS)
Store your static files in a folder called static in your app. For example my_app/static/my_app/example.jpg . Serving the files. In addition to these ......
Read more >
Many Options to Run a Local Static Server | by Jair Reina
You can of course use it just to serve your static files by using this command: ... As you can see, there are...
Read more >
Working with Static and Media Files in Django
This article looks at how to work with static and media files in a Django project, locally and in production.
Read more >
Django Static Files Handling made Simple
This URL should be of the same name as the folder where your static file is stored. Then another important setting comes in...
Read more >
Internationalization And Localization For Static Sites
The first to go on the html element with the dir and lang properties respectively, e.g. <html lang="en" dir-"ltr"> for US English. Properly...
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