jsoverson / preprocess

Preprocess HTML, JavaScript, and other files with directives based off custom or ENV configuration
Other
366 stars 80 forks source link

Return a blank string if the env var is undefined #113

Closed froddd closed 4 years ago

froddd commented 8 years ago

If an ENV var is undefined, using @echo returns undefined as a string (see https://github.com/jsoverson/preprocess/issues/112). This means the documentation, which recommends setting a default JS value, is currently wrong if the ENV var does not exist:

var configValue = '/* @echo FOO */' || 'default value';

produces:

var configValue = 'undefined' || 'default value';

With the fix, this now produces:

var configValue = '' || 'default value';

(Fixes #112)

coveralls commented 8 years ago

Coverage Status

Coverage increased (+0.01%) to 97.581% when pulling 99363ff4b13e0d9908d33e82834907b01d5c8977 on froddd:master into 704d28987837f38abcd6b2e07ba65928e43f2983 on jsoverson:master.