-
-
Save craigmarvelley/9479404adbb9eae4d6a5bb6ea8058fbb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This file is managed at build time by a build script. | |
// @include Readability.js | |
// @include Clipper.js | |
// @include main.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
desc "Build phase script to compile clipper javascript into a single file" | |
lane :compile_clipper_js do |options| | |
working_directory = "#{ENV["BUILT_PRODUCTS_DIR"]}/#{ENV["WRAPPER_NAME"]}" | |
compilation_file_path = "#{working_directory}/compiled.js" | |
compiled_contents = "" | |
File.readlines("#{ENV["PROJECT_DIR"]}/clipper/compiled.js").each do |line| | |
matches = line.match(/^\/\/\s@include (.*)$/) | |
if (!matches) | |
next | |
end | |
file = "#{working_directory}/#{matches.captures.first}"; | |
compiled_contents += "\n\n" + File.read(file); | |
end | |
File.write(compilation_file_path, compiled_contents) | |
puts "Wrote compiled clipper JS to #{compilation_file_path}" | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* global Readability, Clipper */ | |
class ClippedArticlePreprocessor | |
{ | |
run( args ) | |
{ | |
var clipper = new Clipper(); | |
var article = clipper.clip( window, document ); | |
args.completionFunction( article ); | |
} | |
}; | |
var ExtensionPreprocessingJS = new ClippedArticlePreprocessor; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment