@Test public void testWebpackModuleImports() throws Exception { String css, output; File subdir = new File(testdir, "randomDir"); File imported = new File(subdir, "randomFile.css"); subdir.mkdir(); String importedCss = "\r\n\r\n.imported {\r\n\tcolor : black;\r\n}"; CopyUtil.copy(importedCss, new FileWriter(imported)); IConfig config = new ConfigImpl(mockAggregator, tmpdir.toURI(), "{paths: {AMDDir:'" + subdir.toURI() + "'}}"); configRef.set(config); builder.configLoaded(config, seq++); css = "\n\r@import '~AMDDir/randomFile.css'"; File importingFile = new File(subdir, "importingFile.css"); CopyUtil.copy(css, new FileWriter(importingFile)); output = buildCss(new FileResource(importingFile.toURI())); Assert.assertEquals(".imported{color:black}", output); }
@Override public void configLoaded(IConfig conf, long sequence) { final String sourceMethod = "configLoaded"; SignalUtil.lock( configUpdatingRWL.writeLock(), sourceClass, sourceMethod); try { Object obj = conf.getProperty(SIZETHRESHOLD_CONFIGPARAM, null); imageSizeThreshold = TypeUtil.asInt(obj, SIZETHRESHOLD_DEFAULT_VALUE); obj = conf.getProperty(INLINEIMPORTS_CONFIGPARAM, null); inlineImports = TypeUtil.asBoolean(obj, INLINEIMPORTS_DEFAULT_VALUE); obj = conf.getProperty(INCLUDEAMDPATHS_CONFIGPARAM, null); includeAMDPaths = TypeUtil.asBoolean(obj, INCLUDEAMDPATHS_DEFAULT_VALUE); Collection<String> types = new ArrayList<String>(s_inlineableImageTypes); Object oImageTypes = conf.getProperty(IMAGETYPES_CONFIGPARAM, null); if (oImageTypes != IConfig.NOT_FOUND && oImageTypes != null) { if (oImageTypes instanceof String) { String[] aTypes = oImageTypes.toString().split(","); for (String type : aTypes) { types.add(type); } } else { @SuppressWarnings("unchecked") Map<String, String> map = (Map<String, String>)conf.getProperty(IMAGETYPES_CONFIGPARAM, Map.class); inlineableImageTypeMap.putAll(map); } } inlineableImageTypes = types; Collection<Pattern> list = Collections.emptyList(); Object oIncludeList = conf.getProperty(INCLUDELIST_CONFIGPARAM, null); if (oIncludeList != IConfig.NOT_FOUND && oIncludeList != null) { list = new ArrayList<Pattern>(); for (String s : oIncludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageIncludeList = list; list = Collections.emptyList(); Object oExcludeList = conf.getProperty(EXCLUDELIST_CONFIGPARAM, null); if (oExcludeList != IConfig.NOT_FOUND && oExcludeList != null) { list = new ArrayList<Pattern>(); for (String s : oExcludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageExcludeList = list; initPostcss(conf); } finally { configUpdatingRWL.writeLock().unlock(); } }
CSSModuleBuilder extends TextModuleBuilder implements  IExtensionInitializer, IExtensionSingleton, IShutdownListener, IConfigListener { @Override public void configLoaded(IConfig conf, long sequence) { final String sourceMethod = "configLoaded"; SignalUtil.lock( configUpdatingRWL.writeLock(), sourceClass, sourceMethod); try { Object obj = conf.getProperty(SIZETHRESHOLD_CONFIGPARAM, null); imageSizeThreshold = TypeUtil.asInt(obj, SIZETHRESHOLD_DEFAULT_VALUE); obj = conf.getProperty(INLINEIMPORTS_CONFIGPARAM, null); inlineImports = TypeUtil.asBoolean(obj, INLINEIMPORTS_DEFAULT_VALUE); obj = conf.getProperty(INCLUDEAMDPATHS_CONFIGPARAM, null); includeAMDPaths = TypeUtil.asBoolean(obj, INCLUDEAMDPATHS_DEFAULT_VALUE); Collection<String> types = new ArrayList<String>(s_inlineableImageTypes); Object oImageTypes = conf.getProperty(IMAGETYPES_CONFIGPARAM, null); if (oImageTypes != IConfig.NOT_FOUND && oImageTypes != null) { if (oImageTypes instanceof String) { String[] aTypes = oImageTypes.toString().split(","); for (String type : aTypes) { types.add(type); } } else { @SuppressWarnings("unchecked") Map<String, String> map = (Map<String, String>)conf.getProperty(IMAGETYPES_CONFIGPARAM, Map.class); inlineableImageTypeMap.putAll(map); } } inlineableImageTypes = types; Collection<Pattern> list = Collections.emptyList(); Object oIncludeList = conf.getProperty(INCLUDELIST_CONFIGPARAM, null); if (oIncludeList != IConfig.NOT_FOUND && oIncludeList != null) { list = new ArrayList<Pattern>(); for (String s : oIncludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageIncludeList = list; list = Collections.emptyList(); Object oExcludeList = conf.getProperty(EXCLUDELIST_CONFIGPARAM, null); if (oExcludeList != IConfig.NOT_FOUND && oExcludeList != null) { list = new ArrayList<Pattern>(); for (String s : oExcludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageExcludeList = list; initPostcss(conf); } finally { configUpdatingRWL.writeLock().unlock(); } } }
CSSModuleBuilder extends TextModuleBuilder implements  IExtensionInitializer, IExtensionSingleton, IShutdownListener, IConfigListener { @Override public void configLoaded(IConfig conf, long sequence) { final String sourceMethod = "configLoaded"; SignalUtil.lock( configUpdatingRWL.writeLock(), sourceClass, sourceMethod); try { Object obj = conf.getProperty(SIZETHRESHOLD_CONFIGPARAM, null); imageSizeThreshold = TypeUtil.asInt(obj, SIZETHRESHOLD_DEFAULT_VALUE); obj = conf.getProperty(INLINEIMPORTS_CONFIGPARAM, null); inlineImports = TypeUtil.asBoolean(obj, INLINEIMPORTS_DEFAULT_VALUE); obj = conf.getProperty(INCLUDEAMDPATHS_CONFIGPARAM, null); includeAMDPaths = TypeUtil.asBoolean(obj, INCLUDEAMDPATHS_DEFAULT_VALUE); Collection<String> types = new ArrayList<String>(s_inlineableImageTypes); Object oImageTypes = conf.getProperty(IMAGETYPES_CONFIGPARAM, null); if (oImageTypes != IConfig.NOT_FOUND && oImageTypes != null) { if (oImageTypes instanceof String) { String[] aTypes = oImageTypes.toString().split(","); for (String type : aTypes) { types.add(type); } } else { @SuppressWarnings("unchecked") Map<String, String> map = (Map<String, String>)conf.getProperty(IMAGETYPES_CONFIGPARAM, Map.class); inlineableImageTypeMap.putAll(map); } } inlineableImageTypes = types; Collection<Pattern> list = Collections.emptyList(); Object oIncludeList = conf.getProperty(INCLUDELIST_CONFIGPARAM, null); if (oIncludeList != IConfig.NOT_FOUND && oIncludeList != null) { list = new ArrayList<Pattern>(); for (String s : oIncludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageIncludeList = list; list = Collections.emptyList(); Object oExcludeList = conf.getProperty(EXCLUDELIST_CONFIGPARAM, null); if (oExcludeList != IConfig.NOT_FOUND && oExcludeList != null) { list = new ArrayList<Pattern>(); for (String s : oExcludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageExcludeList = list; initPostcss(conf); } finally { configUpdatingRWL.writeLock().unlock(); } } CSSModuleBuilder(); protected  CSSModuleBuilder(IAggregator aggregator, ExecutorService es, int scopePoolSize); }
CSSModuleBuilder extends TextModuleBuilder implements  IExtensionInitializer, IExtensionSingleton, IShutdownListener, IConfigListener { @Override public void configLoaded(IConfig conf, long sequence) { final String sourceMethod = "configLoaded"; SignalUtil.lock( configUpdatingRWL.writeLock(), sourceClass, sourceMethod); try { Object obj = conf.getProperty(SIZETHRESHOLD_CONFIGPARAM, null); imageSizeThreshold = TypeUtil.asInt(obj, SIZETHRESHOLD_DEFAULT_VALUE); obj = conf.getProperty(INLINEIMPORTS_CONFIGPARAM, null); inlineImports = TypeUtil.asBoolean(obj, INLINEIMPORTS_DEFAULT_VALUE); obj = conf.getProperty(INCLUDEAMDPATHS_CONFIGPARAM, null); includeAMDPaths = TypeUtil.asBoolean(obj, INCLUDEAMDPATHS_DEFAULT_VALUE); Collection<String> types = new ArrayList<String>(s_inlineableImageTypes); Object oImageTypes = conf.getProperty(IMAGETYPES_CONFIGPARAM, null); if (oImageTypes != IConfig.NOT_FOUND && oImageTypes != null) { if (oImageTypes instanceof String) { String[] aTypes = oImageTypes.toString().split(","); for (String type : aTypes) { types.add(type); } } else { @SuppressWarnings("unchecked") Map<String, String> map = (Map<String, String>)conf.getProperty(IMAGETYPES_CONFIGPARAM, Map.class); inlineableImageTypeMap.putAll(map); } } inlineableImageTypes = types; Collection<Pattern> list = Collections.emptyList(); Object oIncludeList = conf.getProperty(INCLUDELIST_CONFIGPARAM, null); if (oIncludeList != IConfig.NOT_FOUND && oIncludeList != null) { list = new ArrayList<Pattern>(); for (String s : oIncludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageIncludeList = list; list = Collections.emptyList(); Object oExcludeList = conf.getProperty(EXCLUDELIST_CONFIGPARAM, null); if (oExcludeList != IConfig.NOT_FOUND && oExcludeList != null) { list = new ArrayList<Pattern>(); for (String s : oExcludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageExcludeList = list; initPostcss(conf); } finally { configUpdatingRWL.writeLock().unlock(); } } CSSModuleBuilder(); protected  CSSModuleBuilder(IAggregator aggregator, ExecutorService es, int scopePoolSize); @Override List<ICacheKeyGenerator> getCacheKeyGenerators(IAggregator aggregator); @Override boolean handles(String mid, IResource resource); @Override void shutdown(IAggregator aggregator); @Override void initialize(IAggregator aggregator,
			IAggregatorExtension extension, IExtensionRegistrar registrar); @Override void configLoaded(IConfig conf, long sequence); String dequote(String in); }
CSSModuleBuilder extends TextModuleBuilder implements  IExtensionInitializer, IExtensionSingleton, IShutdownListener, IConfigListener { @Override public void configLoaded(IConfig conf, long sequence) { final String sourceMethod = "configLoaded"; SignalUtil.lock( configUpdatingRWL.writeLock(), sourceClass, sourceMethod); try { Object obj = conf.getProperty(SIZETHRESHOLD_CONFIGPARAM, null); imageSizeThreshold = TypeUtil.asInt(obj, SIZETHRESHOLD_DEFAULT_VALUE); obj = conf.getProperty(INLINEIMPORTS_CONFIGPARAM, null); inlineImports = TypeUtil.asBoolean(obj, INLINEIMPORTS_DEFAULT_VALUE); obj = conf.getProperty(INCLUDEAMDPATHS_CONFIGPARAM, null); includeAMDPaths = TypeUtil.asBoolean(obj, INCLUDEAMDPATHS_DEFAULT_VALUE); Collection<String> types = new ArrayList<String>(s_inlineableImageTypes); Object oImageTypes = conf.getProperty(IMAGETYPES_CONFIGPARAM, null); if (oImageTypes != IConfig.NOT_FOUND && oImageTypes != null) { if (oImageTypes instanceof String) { String[] aTypes = oImageTypes.toString().split(","); for (String type : aTypes) { types.add(type); } } else { @SuppressWarnings("unchecked") Map<String, String> map = (Map<String, String>)conf.getProperty(IMAGETYPES_CONFIGPARAM, Map.class); inlineableImageTypeMap.putAll(map); } } inlineableImageTypes = types; Collection<Pattern> list = Collections.emptyList(); Object oIncludeList = conf.getProperty(INCLUDELIST_CONFIGPARAM, null); if (oIncludeList != IConfig.NOT_FOUND && oIncludeList != null) { list = new ArrayList<Pattern>(); for (String s : oIncludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageIncludeList = list; list = Collections.emptyList(); Object oExcludeList = conf.getProperty(EXCLUDELIST_CONFIGPARAM, null); if (oExcludeList != IConfig.NOT_FOUND && oExcludeList != null) { list = new ArrayList<Pattern>(); for (String s : oExcludeList.toString().split(",")) { list.add(toRegexp(s)); } } inlinedImageExcludeList = list; initPostcss(conf); } finally { configUpdatingRWL.writeLock().unlock(); } } CSSModuleBuilder(); protected  CSSModuleBuilder(IAggregator aggregator, ExecutorService es, int scopePoolSize); @Override List<ICacheKeyGenerator> getCacheKeyGenerators(IAggregator aggregator); @Override boolean handles(String mid, IResource resource); @Override void shutdown(IAggregator aggregator); @Override void initialize(IAggregator aggregator,
			IAggregatorExtension extension, IExtensionRegistrar registrar); @Override void configLoaded(IConfig conf, long sequence); String dequote(String in); static final String INLINEIMPORTS_CONFIGPARAM; static final String INCLUDELIST_CONFIGPARAM; static final String EXCLUDELIST_CONFIGPARAM; static final String IMAGETYPES_CONFIGPARAM; static final String SIZETHRESHOLD_CONFIGPARAM; static final String INCLUDEAMDPATHS_CONFIGPARAM; static final String POSTCSSPLUGINS_CONFIGPARAM; static final String SCOPEPOOLSIZE_CONFIGPARAM; static final String POSTCSS_CONFIGPARAM; static final boolean INLINEIMPORTS_DEFAULT_VALUE; static final boolean INCLUDEAMDPATHS_DEFAULT_VALUE; static final int SIZETHRESHOLD_DEFAULT_VALUE; static final String INLINEIMPORTS_REQPARAM_NAME; static final String INLINEIMAGES_REQPARAM_NAME; static final String PREAMBLE; static final String BLANK; static final String UTF8_CHARSET; static final String POSTCSS_RES_NAME; static final String MINIFYER_RES_NAME; static final String POSTCSS; static final String PROCESS; static final String PLUGINS; static final String POSTCSS_INSTANCE; static final String MODULE; static final String EXPORTS; static final String AMD_DEFINE_SHIM_JS; static final String MINIFIER_INITIALIZATION_VAR; static final String MINIFIER_INITIALIZATION_JS; static final Map<String, Boolean> POSTCSS_OPTIONS; static final int INITIALIZER_THREAD_POOL_SIZE; static final int DEFAULT_SCOPE_POOL_SIZE; static final int SCOPE_POOL_TIMEOUT_SECONDS; public int imageSizeThreshold; public boolean inlineImports; public boolean includeAMDPaths; public Collection<Pattern> inlinedImageExcludeList; }