class Snowpacker::Configuration

Defined in:

ext/athena.cr
snowpacker/configuration.cr

Instance Method Summary

Instance Method Detail

def asset_regex : Regex #

The regex snowpacker.cr uses to match assets. If a request matches this, the request will be redirected to snowpacks dev server. The default regex should be fine for most use cases but this configuration is exposed for advanced use cases.


[View source]
def asset_regex=(asset_regex : Regex) #

The regex snowpacker.cr uses to match assets. If a request matches this, the request will be redirected to snowpacks dev server. The default regex should be fine for most use cases but this configuration is exposed for advanced use cases.


[View source]
def config_path : String #

The path snowpack.config.js will be loaded from.


[View source]
def config_path=(config_path : String) #

The path snowpack.config.js will be loaded from.


[View source]
def enabled : Bool #

If the dev server & extension middleware should be enabled. Ensure this is true when you want the dev server to run. Set false in production.


[View source]
def enabled=(enabled : Bool) #

If the dev server & extension middleware should be enabled. Ensure this is true when you want the dev server to run. Set false in production.


[View source]
def hmr : Bool #

Enables/Disables Hot Module Reloading. Snowpacker will inject the neccessary HMR scripts into a HTML document.


[View source]
def hmr=(hmr : Bool) #

Enables/Disables Hot Module Reloading. Snowpacker will inject the neccessary HMR scripts into a HTML document.


[View source]
def hmr_matching_regex : Regex #

The regex used to locate where the HMR scripts should be injected. You shouldn't typically need to change this. Snowpacker, by default, injects the scripts at the bottom of your HTML document so they load last. Change this value to something else if you would like the scripts to injected into a different location.


[View source]
def hmr_matching_regex=(hmr_matching_regex : Regex) #

The regex used to locate where the HMR scripts should be injected. You shouldn't typically need to change this. Snowpacker, by default, injects the scripts at the bottom of your HTML document so they load last. Change this value to something else if you would like the scripts to injected into a different location.


[View source]
def hostname : String #

The hostname requests will be redirected too. This does NOT change the hostname snowpack actually runs on. Make sure this matches the hostname in your snowpack.config.js file. Snowpack defaults to localhost.


[View source]
def hostname=(hostname : String) #

The hostname requests will be redirected too. This does NOT change the hostname snowpack actually runs on. Make sure this matches the hostname in your snowpack.config.js file. Snowpack defaults to localhost.


[View source]
def node_env : String #

The NODE_ENV that will be prepended to the command starting the snowpack dev server. This can be overwritten via Crystal's environment variables with ENV["NODE_ENV"] = "my_env" if you would prefer.

Crystal nor Node can access environment variables outside of their process for safety reasons. Because of this, snowpacker.cr prepends the env to the command.

Example: `"NODE_ENV=#{Snowpacker.config.node_env} npx snowpack #{cmd}"


[View source]
def node_env=(node_env : String) #

The NODE_ENV that will be prepended to the command starting the snowpack dev server. This can be overwritten via Crystal's environment variables with ENV["NODE_ENV"] = "my_env" if you would prefer.

Crystal nor Node can access environment variables outside of their process for safety reasons. Because of this, snowpacker.cr prepends the env to the command.

Example: `"NODE_ENV=#{Snowpacker.config.node_env} npx snowpack #{cmd}"


[View source]
def port : Int32 #

The port requests will be redirected too. This does NOT change the port snowpack actually runs on. Make sure this matches the port in your snowpack.config.js file. Snowpack defaults to 8080.


[View source]
def port=(port : Int32) #

The port requests will be redirected too. This does NOT change the port snowpack actually runs on. Make sure this matches the port in your snowpack.config.js file. Snowpack defaults to 8080.


[View source]