From ae832583a0a72bd165366324a6cef3a8184d94dd Mon Sep 17 00:00:00 2001 From: Pysis868 Date: Wed, 26 Sep 2018 15:12:23 -0400 Subject: [PATCH] Update README.textile Adding basic Rails instructions, plus those specifically for ES6 support as well. --- README.textile | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/README.textile b/README.textile index 937aa59..9f3ea38 100644 --- a/README.textile +++ b/README.textile @@ -14,6 +14,20 @@ sudo gem install closure-compiler h2. Usage +h3. Rails + +In `config/environments/production.rb`: +
+config.assets.js_compressor = Closure::Compiler.new
+
+ +Specifically for ECMAScript6 support, use this instead: +
+config.assets.js_compressor = Closure::Compiler.new(language_in: 'ECMASCRIPT6')
+
+ +h3. General + The @Closure::Compiler@ has a @compile@ method, which can be passed a string or an open @IO@ object, and returns the compiled JavaScript. The result is returned as a string, or, if a block is passed, yields as an @IO@ object for streaming writes.