webpack-isomorphic-tools
Advanced tools
Comparing version 0.5.2 to 0.6.0
@@ -93,2 +93,14 @@ 'use strict'; | ||
_createClass(webpack_isomorphic_tools, [{ | ||
key: 'development', | ||
// sets development mode flag to true | ||
// (allows asset hot reloading in Webpack development configuration) | ||
value: function development() { | ||
this.debug('entering development mode'); | ||
this.options.development = true; | ||
// allows method chaining | ||
return this; | ||
} | ||
}, { | ||
key: 'populate', | ||
@@ -188,3 +200,3 @@ | ||
_pluginsWriteAssets2['default'].call(this, stats, { | ||
environment: options.development ? 'development' : 'production', | ||
development: options.development, | ||
debug: options.debug, | ||
@@ -197,3 +209,8 @@ output_file: webpack_assets_file_path, | ||
regular_expressions: regular_expressions, | ||
log: { info: tools.info.bind(tools), debug: tools.debug.bind(tools), error: tools.error.bind(tools) } | ||
log: { | ||
info: tools.info.bind(tools), | ||
debug: tools.debug.bind(tools), | ||
warning: tools.warning.bind(tools), | ||
error: tools.error.bind(tools) | ||
} | ||
}); | ||
@@ -216,3 +233,3 @@ }); | ||
// allows chaining | ||
// allows method chaining | ||
return this; | ||
@@ -262,2 +279,7 @@ } | ||
value: function refresh() { | ||
// sanity check | ||
if (!this.options.development) { | ||
this.warning('.refresh() called in production mode'); | ||
} | ||
this.debug('flushing require() caches'); | ||
@@ -327,3 +349,3 @@ | ||
// allows chaining | ||
// allows method chaining | ||
return this; | ||
@@ -447,3 +469,3 @@ } | ||
// allows chaining | ||
// allows method chaining | ||
return this; | ||
@@ -464,2 +486,7 @@ } | ||
}, { | ||
key: 'warning', | ||
value: function warning(message) { | ||
console.log(_colorsSafe2['default'].yellow(log_preamble, '[warning]', generate_log_message(message))); | ||
} | ||
}, { | ||
key: 'error', | ||
@@ -466,0 +493,0 @@ value: function error(message) { |
@@ -27,4 +27,10 @@ 'use strict'; | ||
function write_assets(stats, options) { | ||
var development = options.environment === 'development'; | ||
options.log.debug('running write assets webpack plugin'); | ||
var development = options.development; | ||
if (development) { | ||
options.log.debug(' (development mode is on)'); | ||
} | ||
// webpack stats | ||
@@ -31,0 +37,0 @@ var json = stats.toJson(); |
@@ -1,14 +0,34 @@ | ||
1.2.0 / 10.07.2015 | ||
0.6.0 / 11.08.2015 | ||
=================== | ||
* Pseudo-classes (those ones starting with a colon) and media queries (those ones starting with an at) are now copied to the modifiers (to better support Radium) | ||
* Changed asset functions' "options" argument: the "environment" parameter is replaced by "development" flag | ||
1.1.0 / 10.07.2015 | ||
0.5.0 / 11.08.2015 | ||
=================== | ||
* Changed modifier flag from dot to ampersand | ||
* Accidentially published a next "minor" version. Is a "patch" really | ||
1.0.0 / 06.07.2015 | ||
0.4.0 / 11.08.2015 | ||
=================== | ||
* The assets info file is now called "webpack-assets.json" by default (as opposed to "webpack-stats.json") | ||
* The assets info file is now created in the project folder by default | ||
* Added extensive debug logging | ||
* It now outputs webpack stats JSON object when in debug mode | ||
0.3.0 / 10.08.2015 | ||
=================== | ||
* Renamed "path_parser" asset parameter to "parser" | ||
* Changed parser function arguments | ||
0.2.0 / 10.08.2015 | ||
=================== | ||
* Extracted webpack configuration population logic into a separate method | ||
* "assets" is now an array as opposed to JSON object | ||
0.1.0 / 10.08.2015 | ||
=================== | ||
* Initial release |
{ | ||
"name": "webpack-isomorphic-tools", | ||
"version": "0.5.2", | ||
"version": "0.6.0", | ||
"description": "Transforms CSS-alike text into a React style JSON object", | ||
@@ -5,0 +5,0 @@ "main": "babel-transpiled-modules/index.js", |
@@ -121,5 +121,2 @@ # webpack-isomorphic-tools | ||
{ | ||
// development mode (supports assets hot reload) | ||
development: true, | ||
assets: | ||
@@ -283,6 +280,6 @@ [{ | ||
{ | ||
// is it development or production? | ||
// set this to true, for example, if this is | ||
// the configuration for webpack-dev-server | ||
// (enables asset hot reloading). | ||
// sets "development" mode flag. | ||
// see the API section below for method .development() | ||
// for more explanation about what "development" mode does | ||
// and when is it needed. | ||
development: true, // is false by default | ||
@@ -403,2 +400,16 @@ | ||
## API | ||
#### .development() | ||
Is it development mode or is it production mode? By default it's production mode. But if you're instantiating `webpack-isomorphic-tools` for populating Webpack development configuration then you should call this method to enable asset hot reloading (and disable asset caching). In this case it must be called before `.populate()`, obviously. | ||
#### .populate(webpack_configuration) | ||
Adds the necessary asset module loaders and plugins into the supplied Webpack configuration. | ||
#### .ready() | ||
Waits for `webpack-isomorphic-tools` to finish all the preparations needed. To be more specific, it waits for Webpack to finish the build process and to output the assets info file. | ||
## Gotchas | ||
@@ -405,0 +416,0 @@ |
@@ -61,2 +61,13 @@ import path from 'path' | ||
// sets development mode flag to true | ||
// (allows asset hot reloading in Webpack development configuration) | ||
development() | ||
{ | ||
this.debug('entering development mode') | ||
this.options.development = true | ||
// allows method chaining | ||
return this | ||
} | ||
// adds module loaders and plugins to webpack configuration | ||
@@ -147,3 +158,3 @@ populate(webpack_configuration) | ||
{ | ||
environment : options.development ? 'development' : 'production', | ||
development : options.development, | ||
debug : options.debug, | ||
@@ -154,3 +165,9 @@ output_file : webpack_assets_file_path, | ||
regular_expressions : regular_expressions, | ||
log : { info: tools.info.bind(tools), debug: tools.debug.bind(tools), error: tools.error.bind(tools) } | ||
log: | ||
{ | ||
info : tools.info.bind(tools), | ||
debug : tools.debug.bind(tools), | ||
warning : tools.warning.bind(tools), | ||
error : tools.error.bind(tools) | ||
} | ||
}) | ||
@@ -184,3 +201,3 @@ }) | ||
// allows chaining | ||
// allows method chaining | ||
return this | ||
@@ -228,2 +245,8 @@ } | ||
{ | ||
// sanity check | ||
if (!this.options.development) | ||
{ | ||
this.warning('.refresh() called in production mode') | ||
} | ||
this.debug('flushing require() caches') | ||
@@ -276,3 +299,3 @@ | ||
// allows chaining | ||
// allows method chaining | ||
return this | ||
@@ -375,3 +398,3 @@ } | ||
// allows chaining | ||
// allows method chaining | ||
return this | ||
@@ -393,2 +416,7 @@ } | ||
warning(message) | ||
{ | ||
console.log(colors.yellow(log_preamble, '[warning]', generate_log_message(message))) | ||
} | ||
error(message) | ||
@@ -395,0 +423,0 @@ { |
@@ -8,4 +8,11 @@ import fs from 'fs' | ||
{ | ||
const development = options.environment === 'development' | ||
options.log.debug('running write assets webpack plugin') | ||
const development = options.development | ||
if (development) | ||
{ | ||
options.log.debug(' (development mode is on)') | ||
} | ||
// webpack stats | ||
@@ -12,0 +19,0 @@ const json = stats.toJson() |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
154920
2179
515