protected void registerFlavor(FlavorDescriptor flavor, RuntimeContext extensionContext) { // set flavor presets files content List<FlavorPresets> presets = flavor.getPresets(); if (presets != null) { for (FlavorPresets myPreset : presets) { String src = myPreset.getSrc(); URL url = getUrlFromPath(src, extensionContext); if (url == null) { log.error(String.format("Could not find resource at '%s'", src)); } else { String content; try { content = new String(FileUtils.readBytes(url)); } catch (IOException e) { throw new RuntimeException(e); } myPreset.setContent(content); } } } // set flavor sass variables List<SassImport> sassVars = flavor.getSassImports(); if (sassVars != null) { for (SassImport var : sassVars) { String src = var.getSrc(); URL url = getUrlFromPath(src, extensionContext); if (url == null) { log.error(String.format("Could not find resource at '%s'", src)); } else { String content; try { content = new String(FileUtils.readBytes(url)); } catch (IOException e) { throw new RuntimeException(e); } var.setContent(content); } } } flavorReg.addContribution(flavor); }
public SassImport clone() { SassImport clone = new SassImport(); clone.setSrc(src); clone.setContent(content); return clone; }