RemoveSourceMapUrlProcessor implements ResourcePreProcessor { private void removeAnnotation(Reader reader, Writer writer) throws IOException { LineIterator it = IOUtils.lineIterator(reader); String line; while(it.hasNext()) { line = it.next(); if (!line.startsWith(SOURCE_MAP_URL_PREFIX)) { writer.append(line); writer.append(IOUtils.LINE_SEPARATOR); } } }  @Override void process(Resource resource, Reader reader, Writer writer); static final String ALIAS; }
@Test public void removeAnnotation() throws Exception { final String sourceMapAnnotation = " final String bundledCode = "goog.provide('id');\ngoog.require('id2');\nconsole.log('hello'); console.log('bye');"; Reader reader = new StringReader(bundledCode + "\n" + sourceMapAnnotation); StringWriter writer = new StringWriter(); final RemoveSourceMapUrlProcessor processor = new RemoveSourceMapUrlProcessor(); Resource resource = new Resource(); resource.setMinimize(false); resource.setType(ResourceType.JS); resource.setUri("file: processor.process(resource, reader, writer); assertTrue(writer.toString().contains(bundledCode)); assertFalse(writer.toString().contains(" }