Skip to content

Instantly share code, notes, and snippets.

@y-temp4
Created May 4, 2017 01:05
Show Gist options
  • Save y-temp4/55d95b06f5a168817877d2675eea74d2 to your computer and use it in GitHub Desktop.
Save y-temp4/55d95b06f5a168817877d2675eea74d2 to your computer and use it in GitHub Desktop.
Webpackerのディレクトリ構成をRailsから切り離す形に変える方法 ref: http://qiita.com/y-temp4/items/917fd541676bd04b78a9
# See https://help.github.com/articles/ignoring-files for more about ignoring files.
#
# If you find yourself ignoring temporary files generated by your text editor
# or operating system, you probably want to add a global ignore instead:
# git config --global core.excludesfile '~/.gitignore_global'
# Ignore bundler config.
/.bundle
# Ignore all logfiles and tempfiles.
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
/node_modules
/yarn-error.log
.byebug_history
+/public/entry
-/public/packs
/node_modules
vendor/bundle
/* eslint no-console:0 */
// This file is automatically compiled by Webpack, along with any other files
// present in this directory. You're encouraged to place your actual application logic in
// a relevant structure within app/javascript and only use these pack files to reference
// that code so it'll be compiled.
//
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
// layout file, like app/views/layouts/application.html.erb
import 'stylesheets/application'
import 'javascripts/hello_react.jsx'
console.log('Hello World from Webpacker')
body {
background: red;
}
frontend
├── entry
├── javascripts
└── stylesheets
<%= javascript_pack_tag 'application' %>
<%= stylesheet_pack_tag 'application' %>
{
"application.css": "http://localhost:8080/entry/application.css",
"application.css.map": "http://localhost:8080/entry/application.css.map",
"application.js": "http://localhost:8080/entry/application.js",
"application.js.map": "http://localhost:8080/entry/application.js.map"
}
default: &default
config: config/webpack
- entry: packs
+ entry: entry
output: public
manifest: manifest.json
node_modules: node_modules
- source: app/javascript
+ source: frontend
extensions:
- .coffee
- .js
- .jsx
- .ts
- .vue
- .sass
- .scss
- .css
- .png
- .svg
- .gif
- .jpeg
- .jpg
development:
<<: *default
test:
<<: *default
manifest: manifest-test.json
production:
<<: *default
resolve: {
extensions: paths.extensions,
modules: [
resolve(paths.source),
resolve(paths.node_modules)
]
},
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment