mirror of
https://github.com/livebook-dev/livebook.git
synced 2025-09-12 07:54:49 +08:00
Build assets to tmp/static_dev in development
This commit is contained in:
parent
7e4eccbf6d
commit
406c17dc43
6 changed files with 5 additions and 14 deletions
|
@ -10,6 +10,5 @@ erl_crash.dump
|
||||||
livebook-*.tar
|
livebook-*.tar
|
||||||
npm-debug.log
|
npm-debug.log
|
||||||
/assets/node_modules/
|
/assets/node_modules/
|
||||||
/priv/static_dev/
|
|
||||||
/tmp/
|
/tmp/
|
||||||
/livebook
|
/livebook
|
||||||
|
|
8
.gitignore
vendored
8
.gitignore
vendored
|
@ -28,14 +28,6 @@ npm-debug.log
|
||||||
# The directory NPM downloads your dependencies sources to.
|
# The directory NPM downloads your dependencies sources to.
|
||||||
/assets/node_modules/
|
/assets/node_modules/
|
||||||
|
|
||||||
# During development we build assets from assets/
|
|
||||||
# and they end up in priv/static_dev/, from where they are served.
|
|
||||||
#
|
|
||||||
# For deployment we build the assets to priv/static/
|
|
||||||
# and commit to the reposity, because they have to be accessible
|
|
||||||
# when building Escript locally.
|
|
||||||
/priv/static_dev/
|
|
||||||
|
|
||||||
# The directory used by ExUnit :tmp_dir
|
# The directory used by ExUnit :tmp_dir
|
||||||
/tmp/
|
/tmp/
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ module.exports = (env, options) => {
|
||||||
},
|
},
|
||||||
output: {
|
output: {
|
||||||
filename: '[name].js',
|
filename: '[name].js',
|
||||||
path: path.resolve(__dirname, (devMode ? '../priv/static_dev/js' : '../priv/static/js')),
|
path: path.resolve(__dirname, (devMode ? '../tmp/static_dev/js' : '../priv/static/js')),
|
||||||
publicPath: '/js/'
|
publicPath: '/js/'
|
||||||
},
|
},
|
||||||
devtool: devMode ? 'eval-cheap-module-source-map' : undefined,
|
devtool: devMode ? 'eval-cheap-module-source-map' : undefined,
|
||||||
|
|
|
@ -51,7 +51,7 @@ config :livebook, LivebookWeb.Endpoint,
|
||||||
config :livebook, LivebookWeb.Endpoint,
|
config :livebook, LivebookWeb.Endpoint,
|
||||||
live_reload: [
|
live_reload: [
|
||||||
patterns: [
|
patterns: [
|
||||||
~r"priv/static_dev/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
~r"tmp/static_dev/.*(js|css|png|jpeg|jpg|gif|svg)$",
|
||||||
~r"lib/livebook_web/(live|views)/.*(ex)$",
|
~r"lib/livebook_web/(live|views)/.*(ex)$",
|
||||||
~r"lib/livebook_web/templates/.*(eex)$"
|
~r"lib/livebook_web/templates/.*(eex)$"
|
||||||
]
|
]
|
||||||
|
|
|
@ -28,13 +28,13 @@ defmodule LivebookWeb.Endpoint do
|
||||||
|
|
||||||
defmodule AssetsFileSystemProvider do
|
defmodule AssetsFileSystemProvider do
|
||||||
use LivebookWeb.FileSystemProvider,
|
use LivebookWeb.FileSystemProvider,
|
||||||
from: {:livebook, "priv/static_dev"}
|
from: {:livebook, "tmp/static_dev"}
|
||||||
end
|
end
|
||||||
|
|
||||||
# Serve static failes at "/"
|
# Serve static failes at "/"
|
||||||
|
|
||||||
if code_reloading? do
|
if code_reloading? do
|
||||||
# In development we use assets from priv/static_dev (rebuilt dynamically on every change).
|
# In development we use assets from tmp/static_dev (rebuilt dynamically on every change).
|
||||||
# Note that this directory doesn't contain predefined files (e.g. images),
|
# Note that this directory doesn't contain predefined files (e.g. images),
|
||||||
# so we also use `AssetsMemoryProvider` to serve those from priv/static.
|
# so we also use `AssetsMemoryProvider` to serve those from priv/static.
|
||||||
plug LivebookWeb.StaticPlug,
|
plug LivebookWeb.StaticPlug,
|
||||||
|
|
2
mix.exs
2
mix.exs
|
@ -85,7 +85,7 @@ defmodule Livebook.MixProject do
|
||||||
links: %{
|
links: %{
|
||||||
"GitHub" => "https://github.com/elixir-nx/livebook"
|
"GitHub" => "https://github.com/elixir-nx/livebook"
|
||||||
},
|
},
|
||||||
files: ~w(lib priv/static config mix.exs README.md LICENSE CHANGELOG.md)
|
files: ~w(lib priv config mix.exs README.md LICENSE CHANGELOG.md)
|
||||||
]
|
]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue